If you have learned about the php curl_exec function, you know that it executes a given cURL session. Returns TRUE on success or FALSE on failure.
Sometimes when PHP uses curl to request, the page is blank and nothing is output. Debugging found that the return result was: false. How to solve this situation? This article will introduce the solution when the php curl_exec function returns false
We will directly demonstrate it with examples, I believe you will understand it more clearly.
First is a curl request example;
##Request return result: false;
Debugging, type the curl error number; prompt: Problem (2) in the Chunked-Encoded dataSolution:
Add the following paragraph in front of$output = curl_exec($curlp);
curl_setopt($curlp, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt — Set a cURL transport option.
For details, please refer to the curl_setopt() function in the Run it again and find that the CURL request returns normal results.【Recommended related articles】
1.Detailed explanation of usage examples of PHP curl_exec function
2.Share a solution when the PHP server does not support the php curl_exec function
3.Get the output information of the CURL request from the php curl_exec function
4.php curl_exec() function CURL method to get the return value
The above is the detailed content of Solution to php curl_exec function returning false. For more information, please follow other related articles on the PHP Chinese website!