Curl is a PHP tool class and is used as a reference to the official documentation: http://php.net/manual/zh/book.curl.php
There are detailed instructions for use and parameter introduction.
/** * @param string $url * @return Mixed*/ Public functionDoget ($url) { //Initialize $ch=Curl_init (); curl_setopt ($ch, Curlopt_url,$url); //Do not print directly after executioncurl_setopt ($ch, Curlopt_returntransfer,true); curl_setopt ($ch, Curlopt_header,false); //Skip Certificate Checkcurl_setopt ($ch, Curlopt_ssl_verifypeer,false); //do not check for the existence of SSL encryption algorithms from the certificatecurl_setopt ($ch, Curlopt_ssl_verifyhost,false); //execute and get HTML document content $output= Curl_exec ($ch); //releasing the curl handleCurl_close ($ch); return $output; } /** * @param string $url * @param array $post _data * @param array | Boolean $header * @return Mixed */ Public functionDoPost ($url,$post _data,$header) { $ch=Curl_init (); curl_setopt ($ch, Curlopt_url,$url); //Do not print directly after executioncurl_setopt ($ch, Curlopt_returntransfer,true); //set the request mode to postcurl_setopt ($ch, Curlopt_post,true); //Variables for postcurl_setopt ($ch, Curlopt_postfields,$post _data); //request headers, which can be passed to an arraycurl_setopt ($ch, Curlopt_header,$header); //Skip Certificate Checkcurl_setopt ($ch, Curlopt_ssl_verifypeer,false); //do not check for the existence of SSL encryption algorithms from the certificatecurl_setopt ($ch, Curlopt_ssl_verifyhost,false); $output= Curl_exec ($ch); Curl_close ($ch); return $output; }
Where the certificate is skipped in order to access HTTPS.
How to implement get and post requests using curl in PHP