PHP関数共有のcurl方式でデータを取得し、アナログ登録、POSTデータ
余計なことを言わないで、直接コードを入れてください。
/********************** curl ***********************/
// curl ( POST、HEADER )
/*
* $url: , http; , https
* $header:
* $post: post array
* $cookies: 0 cookie,1 ,2
*/
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);
// header
if($header != FALSE){
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
}
//post
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;
}