- //php curl實例代碼如下:
- session_write_close();
- $pageurl = "http://m.survivalescaperooms.com/index.html";
- curl_setopt($ch, curlopt_returntransfer, 1);
- curl_setopt ($ch, curlopt_url, $pageurl );
- $html = curl_exec ( $ch );
- curl_close($ch);
- //then you need to fix pathing to absolute
- $search = "/(src|href|background)="[^:,^>,^"]*"/i";
- preg_match_all ( $search, $html, $a_matches );
- //php fopen實例,代碼如下:
- $file = fopen("http://m.survivalescaperooms.com/","r"); //讀取遠程文件
- $file = fopen("a.txt","r");//讀取本地文件
- //php file_get_contents
- $homepage = file_get_contents('http://m.survivalescaperooms.com/'); //讀取遠程文本
- echo $homepage;
- :
- // <= php 5
- $file = file_get_contents('./people.txt', true);
- // > php 5
- $file = file_get_contents('./people.txt', file_use_include_path); //打開本地文本
新聞熱點
疑難解答