반응형
function get_surl($url)
{
$ch = curl_init();
$header_data = array("User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"
, "Referer: https://am0900.tistory.com");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true); // 헤더 정보 보냄
curl_setopt($ch, CURLOPT_HTTPHEADER, $header_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
$res = curl_exec($ch);
if(!$res)
{
//var_dump(curl_error($ch));
return "ERROR";
}
curl_close($ch);
return $res;
}
echo get_surl("https://am0900.tistory.com");
2020.11.09 - [분류 전체보기] - php fsockopen으로 https 페이지 가져오기
2017.08.11 - [분류 전체보기] - curl VS snoopy VS fsockopen VS fopen VS stream 속도비교
반응형