view code 1 $srv_ip = ' 192.168.0.118 ' ; // 你的目标服务地址或频道(一定不能有http: // ). 2 $srv_port = 80 ; 3 $errno = 0 ; 4 $errstr = '' ; 5 $timeout = 10 ; 6 7 $url = ' /phpandservice/socketserversend.aspx ' ; // 接收你post的url具体地
view code
1 $srv_ip = '192.168.0.118'; //你的目标服务地址或频道(一定不能有http://).
2 $srv_port = 80;
3 $errno = 0;
4 $errstr = '';
5 $timeout = 10;
6
7 $url = '/phpandservice/socketserversend.aspx'; //接收你post的url具体地址
8 $fp = '';
9 $resp_str = '';
10 $post_str = $_post[content]; //要提交的内容.
11
12 if ($srv_ip == '') {
13 echo('ip or dest url empty
');
14 }
15
16 $fp = fsockopen($srv_ip, $srv_port, $errno, $errstr, $timeout);
17 if (!$fp) {
18 echo('fp fail');
19 }
20
21 $content_length = strlen($post_str);
22 $post_header = post $url http/1.1\r\n;
23 $post_header .= content-type: application/x-www-form-urlencoded\r\n;
24 $post_header .= user-agent: msie\r\n;
25 $post_header .= host: . $srv_ip . \r\n;
26 $post_header .= content-length: . $content_length . \r\n;
27 $post_header .= connection: close\r\n\r\n;
28 $post_header .= $post_str . \r\n\r\n;
29 fwrite($fp, $post_header);
30
31 while (!feof($fp)) {
32 $resp_str .= fgets($fp, 512); //返回值放入$resp_str
33 }
34 fclose($fp);
35 echo($resp_str); //处理返回值.
条件限制,ipad调用php(网站),php调用aspx(网站),aspx调用webservice(网站)
php调用aspx已经实现(post传递),可是aspx要怎么返回数据告诉php执行成功与否呢?
附有网上copy来的php调用aspx实现,可是我不知道aspx页面要怎么写才能返回一个数据给php,请指教
