No further nonsense and let’s get straight to the code
Copy code The code is as follows:
/************************** curl series ***********************/
//Get it directly through curl Data (including POST, HEADER, etc.)
/*
* $url: If it is not an array, it is http; if it is an array, it is https
* $header: Header file
* $post: Submit array form in post mode
* $cookies: 0 defaults to no cookie, 1 is setting, 2 is getting
*/
public function curl_allinfo($urls, $header = FALSE, $post = FALSE, $ cookies = 0) {
$url = is_array($urls) ? $urls['0'] : $urls;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Submit with header
if($header != FALSE){
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
}
//Post submission method
if($post != FALSE){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
if($cookies == 1){
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookiefile");
}else if($cookies == 2){
curl_setopt($ch, CURLOPT_COOKIEFILE , "cookiefile");
}
if(is_array($urls)){
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
http://www.bkjia.com/PHPjc/779570.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/779570.htmlTechArticleWithout further ado, just copy the code. The code is as follows: /************************** curl series ***********************/ //Directly pass Obtain data through curl (including POST, HEADER, etc.)...