Home >Backend Development >PHP Tutorial >Regarding PHP interface issues (php interface mainly uses curl and curl functions)_PHP tutorial

Regarding PHP interface issues (php interface mainly uses curl and curl functions)_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:01:46850browse

Interface problem
The most important thing for php to call the interface is to use curl to grab information

Copy code Code As follows:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); //url address
curl_setopt($ch, CURLOPT_POST, true); / /Whether to post request
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); //Data passed by post request
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);//Set header
curl_setopt($ch , CURLOPT_RETURNTRANSFER, true); //Return the obtained output text stream
$response = curl_exec($ch); //Get the returned data
curl_close($ch); //Close

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327969.htmlTechArticleInterface problem The most important thing about calling the interface in php is to use curl to grab information. Copy the code. The code is as follows: $ch = curl_init( ); curl_setopt($ch, CURLOPT_URL, $url);//url address curl_setopt($ch,...
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