Home >Backend Development >PHP Tutorial >Detailed explanation of steps to obtain return value with php curl
This time I will bring you a detailed explanation of the steps for php curl to obtain the return value. What are the precautions for php curl to obtain the return value? The following is a practical case, let's take a look.
php curl implementation method of getting the return value在curl中有一个参数 curlopt_ return transfer :
curl_setopt($ch, curlopt_returntransfer, 0);The default is 0 and directly returns the text stream of the obtained output. Sometimes the return value is used for judgment or other purposes.
Fortunately, curlopt_returntransfer can be set. If it is set to curlopt_returntransfer 1:
curl_setopt($ch, curlopt_returntransfer, 1);can be used before closing a curl session without curl_close: curl_multi_getcontent($ch)
to get the server return value. . It is
string type!
curl_multi_getcontent( resource $ch )If curlopt_returntransfer as an option is set to a specific handle, then this
function will return the content obtained by that curl handle in the form of a string.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website! Recommended reading:array_combine() array merge function usage case details
The above is the detailed content of Detailed explanation of steps to obtain return value with php curl. For more information, please follow other related articles on the PHP Chinese website!