ViewCode1 $ srv_ip192.168.0.118; your target service address or channel (must not have http :). 2 $ srv_port80; 3 $ errno0; 4 $ errstr; 5 $ timeout10; 67 $ urlPhpAndServicesocketServerSend. aspx; receives your post URL
View Code 1 $ srv_ip = '192.168.0.118 '; // your target service address or channel (you must not have http ://). 2 $ srv_port = 80; 3 $ errno = 0; 4 $ errstr = ''; 5 $ timeout = 10; 6 7 $ url = '/PhpAndService/socketServerSend. aspx '; // receives the URL of your post.
View Code
1 $ srv_ip = '192. 168.0.118 '; // your target service address or channel (you must not have http ://).
2 $ srv_port = 80;
3 $ errno = 0;
4 $ errstr = '';
5 $ timeout = 10;
6
7 $ url = '/PhpAndService/socketServerSend. aspx'; // The specific address for receiving your post URL
8 $ fp = '';
9 $ resp_str = '';
10 $ post_str = $ _ POST ["content"]; // content to be submitted.
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 ";
28 $ post_header. = $ post_str. "\ r \ n ";
29 fwrite ($ fp, $ post_header );
30
31 while (! Feof ($ fp )){
32 $ resp_str. = fgets ($ fp, 512); // put the returned value into $ resp_str
33}
34 fclose ($ fp );
35 echo ($ resp_str); // process the returned value.
Conditional restrictions: ipad calls PHP (website), PHP calls Aspx (website), and Aspx calls WebSErvice (website)
Php has implemented the call to aspx (post transfer), but how does aspx return data to tell php whether the execution is successful or not?
Php with online copy calls aspx implementation, but I don't know how to write the aspx page to return a data to php. Please advise