Home > Backend Development > PHP Tutorial > PHP CURL method to get return value_PHP tutorial

PHP CURL method to get return value_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:30:44
Original
834 people have browsed it

There is a parameter CURLOPT_RETURNTRANSFER in CURL:

Copy code The code is as follows:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);

The default is 0, which directly returns the text stream of the obtained output. Sometimes, it is not good if we want to use the return value for judgment or other purposes.

Fortunately, CURLOPT_RETURNTRANSFER can be set. If it is set to CURLOPT_RETURNTRANSFER 1:

Copy the code The code is as follows:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

Then you can use curl_multi_getcontent($ch)
before closing a cURL session without curl_close to get the value returned to us by the server. It is a string type!
PHP manual is as follows:
Copy code The code is as follows:
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 as a string.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/764616.htmlTechArticleThere is a parameter CURLOPT_RETURNTRANSFER in CURL: Copy the code as follows: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); Default Is 0 to directly return the obtained output text stream, there are...
Related labels:
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template