Php curl simulates post to send data, partial loss solution

Source: Internet
Author: User
Php curl simulates post to send data, some of which are lost. I use curl to simulate post to send data, and the c/c ++ sent to the receiving Page is c/c & nbsp; the following ++ disappears. In addition, when the post data is used, & amp; is used to separate the data, but if the data itself contains the & amp; character, php curl simulates post to send data, partially missing
I use curl to simulate post to send data,
The c/c ++ sent to the receiving Page is c/c.
The ++ behind is gone,
In addition,
Use & separate data during post,
But if the data itself contains the & operator, how can we transmit & as a value instead of a separator ??
Please advise!

------ Solution --------------------
This is the client code
PHP code
$ Ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, "http: // localhost/test2.php"); curl_setopt ($ ch, CURLOPT_HEADER, false); curl_setopt ($ ch, CURLOPT_POST, true); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ ch, CURLOPT_POSTFIELDS, array ("param" => "c/c ++ ", "param2" => "df & dfdf"); $ data = curl_exec ($ ch); $ code = curl_getinfo ($ ch, CURLINFO_HTTP_CODE); curl_close ($ ch ); $ result = array ("code" => $ code, "data" => $ data); print_r ($ result );

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.