php curl、fopen、file_get_contents实例代码 |
时间:2015-01-23 来源:西部数据 作者:西部数据 |
|
-
-
- session_write_close();
- $pageurl = "http://www.phpfensi.com/index.html";
- curl_setopt($ch, curlopt_returntransfer, 1);
- curl_setopt ($ch, curlopt_url, $pageurl );
- $html = curl_exec ( $ch );
- curl_close($ch);
-
- $search = "/(src|href|background)="[^:,^>,^"]*"/i";
- preg_match_all ( $search, $html, $a_matches );
-
-
-
- $file = fopen("http://www.phpfensi.com/","r"); //读取远程文件
- $file = fopen("a.txt","r");
-
- $homepage = file_get_contents('http://www.phpfensi.com/'); //读取远程文本
- echo $homepage;
- :
-
- $file = file_get_contents('./people.txt', true);
-
- $file = file_get_contents('./people.txt', file_use_include_path);
|
|
|
|