file_get_contents()를 CURL로 바꾸기
Author : 치치     Date :  2020-02-09 11:17:42   Views : 2회  

file_get_contents()를 사용하려면 php.ini allow_url_fopen=on; 설정 변경이 필요합니다.

php.ini를 수정할 수 없으면 curl를 사용합니다.

 

//Any google url. This example is fake for Google Drive direct link.
$url = "https://drive.google.com/uc?id=0BxQKKJYjuNElbFBNUlBndmVHHAj";

$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);  
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 3);     
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$html = curl_exec($ch);
curl_close($ch);

echo $html;

 





❌Delete 🛠Modify 🐣Reply 📄List
No Subject
Author Date Like Views