[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程批处理在线视频分享
返回列表 发帖

[网络连接] 怎么利用批处理调用wget,curl读取文本内容post,求教写法,有偿

本帖最后由 pcl_test 于 2017-8-7 22:02 编辑

怎么利用任何第三方或办法 wgeg,curl类调用下面文本内容post,有偿请高手写出完整语句

文本内容如下   http.txt
新请求post
https://www.nmap.org/nmap/api/licenses/

请求头:
Host: nmap.org
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0
Accept: */*
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: https://nmap.org/pasrg/sfwert
X-CSRF-Token: REljeDItU1NzGjAvSmcMNgt/VDZRQBRjIQEOTQRjFQMDJjYdQ08QKg==
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 36
Cookie: language=eaed5098042e39c55cacf133c6e8b29b5f5336838e5c2e411e57695c71970203a%3A2%3A%7Bi%3A0%3Bs%3A8%3A%22language%22%3Bi%3A1%3Bs%3A5%3A%22zh-CN%22%3B%7D; _ym_uid=1502057250433169819; _ym_isad=2; _u=037591c8cab86f7dfd48edfdf86fa68a1d9a2932bd453c8f19cf4d3634357c28a%3A2%3A%7Bi%3A0%3Bs%3A2%3A%22_u%22%3Bi%3A1%3Bs%3A81%3A%22%5B9384%2C%223854aef71f890450e813da53f81ed2bef6ff7154ac12bff2a363642fb4804dd3%22%2C1209600%5D%22%3B%7D; _ym_visorc_44448889=w; _s=it1ihc9t6fm04shf7mcnk7u16a; _h=56f10194dc2fe06332629036b2d1b835ce17291da0c8c1735f3e0b2fba78f250a%3A2%3A%7Bi%3A0%3Bs%3A2%3A%22_h%22%3Bi%3A1%3Bs%3A32%3A%227SSWxJ_eO67NcmG0eHm56NFPGoUeqbCy%22%3B%7D
Connection: keep-alive

提交的数据:
ip=222.100.152.160&ip_id=10562&id=15437以上就是所有文本内容


能写出完整处理办法语句的,来拿悬赏,悬赏不多,1,2包烟钱还是得给的~~

连句“谢谢”都不舍得给的家伙,就不要说啥“一两包烟钱”啦,

在这里混的人智商都比你高。

伸手要代码也就罢了,现在居然明目张胆地骗代码。

可怜、可悲、更可恨。

TOP

本帖最后由 523066680 于 2017-8-8 19:02 编辑

示例代码,不用谢
  1. //post
  2. #include<stdio.h>
  3. #include<winsock2.h>
  4. #include<windows.h>
  5. #pragma comment(lib, "ws2_32.lib")
  6. int main()
  7. {
  8.     int num;
  9.     SOCKET s;
  10.     WSADATA wsa;
  11.     struct sockaddr_in serv;
  12.     char sndBuf[1024], rcvBuf[2048];
  13.     WSAStartup(MAKEWORD(2, 1), &wsa);
  14.     if ((s = socket(AF_INET, SOCK_STREAM, 0))<0)
  15.     {
  16.         perror("socket error!");
  17.         exit(1);
  18.     }
  19.     memset(&serv,0,sizeof(serv));
  20.     serv.sin_family = AF_INET;
  21.     serv.sin_port = htons(80);
  22.     serv.sin_addr.S_un.S_addr = inet_addr("115.239.210.26");
  23.     if ((connect(s, (struct sockaddr *)&serv, sizeof(serv)))<0)
  24.     {
  25.         perror("connet error!");
  26.         exit(1);
  27.     }
  28.     memset(sndBuf, 0, 1024);
  29.     memset(rcvBuf, 0, 2048);
  30.     //头信息
  31.     strcat(sndBuf, "POST ");
  32.     strcat(sndBuf, "http://www.baidu.com");
  33.     strcat(sndBuf, " HTTP/1.0\r\n");
  34.     strcat(sndBuf, "Host: ");
  35.     strcat(sndBuf, "baidu.com");
  36.     strcat(sndBuf, "\r\n");
  37.     strcat(sndBuf, "Connection: keep-alive\r\n");
  38.     strcat(sndBuf, "\r\n");
  39.     puts(sndBuf);
  40.   
  41.     if ((num = send(s,sndBuf,1024, 0))<0)
  42.     {
  43.         perror("send error!");
  44.         exit(1);
  45.     }
  46.    
  47.     puts("send success!\n");
  48.     do
  49.     {
  50.         if ((num = recv(s, rcvBuf, 2048, 0))<0)
  51.         {
  52.             perror("recv error!");
  53.             system("pause");
  54.             exit(1);
  55.         }
  56.         else if (num>0)
  57.         {
  58.             printf("%s", rcvBuf);
  59.             memset(rcvBuf, 0, 2048);
  60.         }
  61.     }
  62.     while (num>0);
  63.    
  64.     puts("\nread success!\n");
  65.     closesocket(s);
  66.    
  67.     system("pause");
  68.     WSACleanup();
  69.    
  70.     return 0;
  71. }
复制代码
1

评分人数

综合型编程论坛
Writing Code That Nobody Else Can Read.

TOP

返回列表