file_get_contents超时处理

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,转载请注明出处。

posted @ 2012-07-12 13:32  superfans98  阅读(463)  评论(1编辑  收藏  举报