superfans98 发表于 2012-12-10 13:10:47

file_get_contents超时处理

<div id="cnblogs_post_body">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,转载请注明出处。
页: [1]
查看完整版本: file_get_contents超时处理