1. 程式人生 > php教程 > file_get_contents超時處理_PHP教程

file_get_contents超時處理_PHP教程

file_get_contents(url)超時處理,比較好的方式是怎麼樣的?
$opts = array(   
2.‘http'=>array(   
3.‘method'=>”GET”,   
4.‘timeout'=>60,   
5.)   
6.);   
7.$context = stream_context_create($opts);   
8.$html =file_get_contents('example.com', false, $context);   
9.fpassthru($fp);
有沒有比這個方式要好的?


curl

 

本文來源於http://code.niuc.org/thread-965-1-5.html,轉載請註明出處。