php curl_exec() function CURL method to get the return value
May 18, 2017 am 10:45 AMThere is a parameter in CURL CURLOPT_RETURNTRANSFER: This parameter returns the information obtained by curl_exec() in the form of a file stream instead of outputting it directly. For example: The function of the CURLOPT_RETURNTRANSFER parameter is to
assign the content obtained by CRUL to a variable. It defaults to 0 and directly returns the text stream of the obtained output. Sometimes, it would not be good if we want to use the return value for judgment or other purposes. Therefore, sometimes we want the returned content to be stored in variables instead of being output directly, so what should we do? This article mainly introduces the method of
php curl_exec() function CURL to obtain the return valueIn fact, CURLOPT_RETURNTRANSFER can be set. If it is set to CURLOPT_RETURNTRANSFER 1, it will use PHP curl to obtain the page content or Submit data and store it as a variable instead of outputting it directly.
1 |
|
Let’s look at two examples below,
1. Curl gets the page content and directly outputs the example:1 2 3 4 5 6 7 8 9 |
|
1 2 3 4 5 6 7 8 9 10 11 |
|
1.
Detailed explanation of usage examples of PHP curl_exec functionShare a solution when the PHP server does not support the php curl_exec functionGet the output information of the CURL request from the php curl_exec functionThe above is the detailed content of php curl_exec() function CURL method to get the return value. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to realize the mutual conversion between CURL and python requests in python

Tutorial on updating curl version under Linux!

PHP8.1 released: Introducing curl for concurrent processing of multiple requests

Three ways to get thread return value in Python

From start to finish: How to use php extension cURL to make HTTP requests

How to solve the problem that scanf return value is ignored

Use Java's Math.min() function to compare the size of two numbers and return the smaller value
