Home  >  Article  >  Backend Development  >  How to get the return value in php curl

How to get the return value in php curl

WBOY
WBOYOriginal
2016-07-25 09:13:101620browse

Contents of this section: How to implement php curl to get the return value

There is a parameter curlopt_returntransfer in curl:

  1. curl_setopt($ch, curlopt_returntransfer, 0);
Copy code

The default is 0 to directly return 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 set to curlopt_returntransfer 1:

  1. curl_setopt($ch, curlopt_returntransfer, 1);
Copy code

can be used without curl_close before closing a curl session: curl_multi_getcontent($ch) You can get the server return value. It is a string type! The php manual is as follows:

  1. curl_multi_getcontent( resource $ch )
Copy code

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 .



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