使用Libcurl从Web服务器中的wicket ajax获取响应

问题描述

难怪libcurl能否从网页中的wicket ajax函数获得响应? 因为我想将文件上传到Web服务器,但是需要加载网页时接收的参数。这是检票口ajax的curl命令/ URL响应;

curl "https://192.168.10.167/ui/backup/upload?3-2.IBehaviorListener.0-resumableUploadPanel-storageFile-0-item~status-status~container^&_=1601452951304" -H "Connection: keep-alive" -H "Accept: application/xml,text/xml,*/*; q=0.01" -H "X-Requested-With: XMLHttpRequest" -H "Wicket-Ajax-BaseURL: backup/upload?3" -H "Wicket-Ajax: true" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/78.0.3904.70 Safari/537.36" -H "Sec-Fetch-Site: same-origin" -H "Sec-Fetch-Mode: cors" -H "Referer: https://192.168.10.167/ui/backup/upload?3" -H "Accept-Encoding: gzip,deflate,br" -H "Accept-Language: en-US,en;q=0.9" -H "Cookie: JSESSIONID=7D6307648979389393C" --compressed --insecure &

我需要的是1601452951304。

我尝试进入该页面,放置重定向命令并使用以下代码检索重定向网址:

curl_easy_setopt(curl,CURLOPT_URL,"https://192.168.10.167/ui/backup/upload");
curl_easy_setopt(curl,CURLOPT_HEADER,"Accept: application/xml,*/*; q=0.01");
curl_easy_setopt(curl,CURLOPT_ENCODING,"gzip,br");
curl_easy_setopt(curl,"Accept-Language: en-US,en;q=0.9");
curl_easy_setopt(curl,"Connection: keep-alive");
curl_easy_setopt(curl,"Host: 192.168.10.167");
curl_easy_setopt(curl,"Sec-Fetch-Mode: cors");
curl_easy_setopt(curl,"Sec-Fetch-Site: same-origin");
curl_easy_setopt(curl,"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/78.0.3904.70 Safari/537.36");https://192.168.10.167/ui/backup/upload?7");

curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,0);
curl_easy_setopt(curl,CURLOPT_VERBOSE,1L);
curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION,1);
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
    char *url = NULL;
    curl_easy_getinfo(curl,CURLINFO_EFFECTIVE_URL,&url);
    if(url)
      printf("Redirect to: %s\n",url);
  } 

但收到以下错误:

  • 无法将输出写入目标位置
  • 读取分块编码的流失败

这是我在网页中找到的生成网址的功能:

</script>
<script type="text/javascript" >
/*<![CDATA[*/
Wicket.Event.add(window,"load",function(event) { 
Wicket.Timer.set('ide',function(){Wicket.Ajax.ajax({"u":"./upload?3-3.IBehaviorListener.0-resumableUploadPanel-storageFile-0-item~status-status~container","c":"ide"});},1000);;
Wicket.Timer.set('id7',function(){Wicket.Ajax.ajax({"u":"./upload?3-3.IBehaviorListener.0-resumableUploadPanel-agentRegisterCheck","c":"id7"});},5000);;
;});
/*]]>*/
</script>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)