|
发表于 2019-8-19 00:20:31
|
显示全部楼层
湖南省株洲市
- <?php
- function _url($Date){
- $ch = curl_init();
- $timeout = 5;
- curl_setopt ($ch, CURLOPT_URL, "$Date");
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
- curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
- $contents = curl_exec($ch);
- curl_close($ch);
- return $contents;
- }
- $pageURL="http://123.net/";
- $contents=_url($pageURL);
- echo $contents;
- $htmlname="index.html";
- $fp = fopen($htmlname, "w");
- fwrite($fp, $contents);
- fclose($fp);
- ?>
复制代码 |
评分
-
参与人数 1 | 荣誉 +1 |
收起
理由
|
笨潴
| + 1 |
热心帮助他人,荣誉+1,希望继续努力(*^__^*) 嘻嘻! |
查看全部评分
|