Php is used as a server to receive data.

Source: Internet
Author: User
Php serves as the server to accept data. This post was last edited by chaoyangqq from 2014-03-at the bottom layer. what teammates do is to read only the data in the http message data, how should I communicate with him! I tried to use curl to read data but it was unsuccessful. curl_setopt ($ ch, & nbsp; CURLOPT_URL, 19 php was used to receive data on the server.

This post was last edited by chaoyangqq at 08:40:28

What the bottom layer does not understand is that teammates only want to read the data in the http packet data. how should I communicate with him! I tried to use curl to read but failed.
Curl_setopt ($ ch, CURLOPT_URL, "192.168.16.254: 8080 ");
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
// Save it to a string or output it to the screen, 1 hidden
Curl_setopt ($ ch, CURLOPT_TIMEOUT, 1); // obtain the information of up to one second
Curl_setopt ($ ch, CURLOPT_HEADER, 0 );
Echo $ output = curl_exec ($ ch );
Curl_close ($ ch );

For guidance.
------ Solution --------------------
The php server that receives client data can be obtained through $ _ POST, $ _ GET, $ _ REQUEST. The client needs to use the corresponding $ _ post and $ _ get to submit data. $ _ REQUEST seems to be okay.
As for the difference between $ _ POST and $ _ GET, you can find too many items on Baidu.
$ _ POST, $ _ GET returns the parameters passed by your client. you can process these parameters to complete the function. to return data to the client, you only need echo.
I am working on a php server Recently. I don't know why. I cannot GET data using $ _ POST, $ _ GET, $ _ REQUEST. So I found $ GLOBALS [$ HTTP_RAW_POST_DATA] and file_get_contents ("http: // input") to get the data.
Both of the above methods can obtain the first type of data in the post request from the client.
I used the second $ request = file_get_contents ("http: // input") to get the post parameters from the client.

I only need to work on the php server temporarily. I don't know much about it because I haven't learned through the system. I just got the php server ready. Hope to help you.
------ Solution --------------------
Echo $ output = curl_exec ($ ch); no data?

Possible causes
1.192.168.16.254: 8080 this page has no output.
2. curl connection error. you can add curl_error to view the error.

if(curl_errno($ch)){
echo 'curl error:'.curl_error($ch);
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.