In A. php, data is submitted to B. php In post mode, but data cannot be received in B. php, And the curl operation is displayed as successful, which is very strange. Originally,"When an array is passed to curlopt_postfields, curl encodes the data into multipart/form-data, and then transmits a URL-encoded string, the data is encoded into application/X-WWW-form-urlencoded.
", While people who are not familiar with curl, like me, often look like the following code when writing a program:
$ DATA = array ('title' => $ title, 'content' => $ content, 'comefrom' => $ comefrom );
Curl_setopt ($ ch, curlopt_dns_use_global_cache, false );
Curl_setopt ($ ch, curlopt_url, 'HTTP: // example.com/ B .php ');
Curl_setopt ($ ch, curlopt_post, 1 );
Curl_setopt ($ ch, curlopt_postfields, $ data );
Curl_exec ($ ch );
That is, the data to be submitted is sent in the form of an array through post, which causes curl to use the "error" encoding "multipart/form-data ", the effect is equivalent to "<form method =" Post "Action =" B. PHP "enctype =" multipart/form-Data ">" to complete the operation. You can try it. PHP "cannot receive data through $ _ post in any way.
Therefore, the correct method should be to change the $ data in the above sample code from an array to URL code () encoded.
From http://blog.renren.com/share/246611432/7511385884