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 );