|
/********************** Curl Series ***********************/
Get data directly through curl (including post, header, etc.)
/*
* $url: http if not an array;
* $header: Header file
* $post: Post mode submit Array form
* $cookies: 0 default no cookie,1 for setting, 2 for 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;
}
|