Detailed explanation of steps to obtain return value with php curl

php中世界最好的语言
Release: 2023-03-27 07:52:01
Original
4759 people have browsed it

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 :
Copy after login
curl_setopt($ch, curlopt_returntransfer, 0);
Copy after login

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);
Copy after login

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 )
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!