resource context 是一个流句柄... 可以用 Here is an example.<?php// Define a context for HTTP. $aContext = array( 'http' => array( 'proxy' => 'tcp://127.0.0.1:8080', // This needs to be the server and the port of the NTLM Authentication Proxy Server. 'request_fulluri' => True, ), ); $cxContext = stream_context_create($aContext);// Now all file stream functions can use this context.$sFile = file_get_contents("http://www.php.net", False, $cxContext);echo $sFile; ?> 以指定代理等......这几个参数与 指定行数无关.... 手册上也说明,一般用 NULL 即可....
$start=0;
$length=300;
file_get_contents($url, false, NULL, $start, $length);
带[]的意思是参数可选...
可以写为
file_get_contents($url);
file_get_contents($url, false);
file_get_contents($url, false, NULL);
file_get_contents($url, false, NULL, $start);
file_get_contents($url, false, NULL, $start, $length);
分别对应的是什么?
手册上没有对参数解释
bool use_include_path [, resource context
这到底是什么东东
可以用
Here is an example.<?php// Define a context for HTTP.
$aContext = array(
'http' => array(
'proxy' => 'tcp://127.0.0.1:8080', // This needs to be the server and the port of the NTLM Authentication Proxy Server.
'request_fulluri' => True,
),
);
$cxContext = stream_context_create($aContext);// Now all file stream functions can use this context.$sFile = file_get_contents("http://www.php.net", False, $cxContext);echo $sFile;
?>
以指定代理等......这几个参数与 指定行数无关.... 手册上也说明,一般用 NULL 即可....
curl.
?
那我要抓取别人网站上的内容还能用什么呢?fsockopen 不错,可以使用 http/1.1 能够压缩传输内容,使用的带宽为未压缩的1/3--1/2左右,