问点php与html之间传值的问题
程序员文章站
2022-05-14 12:41:12
...
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,请指教
下一篇: PHP函数点评