Home >Backend Development >PHP Tutorial >Detailed explanation of steps to obtain return value with php curl

Detailed explanation of steps to obtain return value with php curl

php中世界最好的语言
php中世界最好的语言Original
2018-05-21 11:13:214803browse

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

##array_search() function returns by element value Detailed explanation of key name steps

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn