亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

cURL crawls the page to crawl the web page information and replace it

Replace page information

<?php
$curlobj = curl_init();          // 初始化
curl_setopt($curlobj, CURLOPT_URL, "http://www.baidu.com");       // 設(shè)置訪問網(wǎng)頁的URL
curl_setopt($curlobj, CURLOPT_RETURNTRANSFER, true);         // 執(zhí)行之后不直接打印出來
$output=curl_exec($curlobj);   // 執(zhí)行
curl_close($curlobj);        // 關(guān)閉cURL
echo str_replace("百度","php",$output);
?>

We will change Baidu to PHP in the crawled Baidu page. The previous chapter was viewed under DOS. In this section, we directly use PHP to parse and view it.

Open on the web page, the effect is as follows

QQ截圖20161105164650.png

In this way, we have completed the replacement of the obtained page content.

Continuing Learning
||
<?php $curlobj = curl_init(); // 初始化 curl_setopt($curlobj, CURLOPT_URL, "http://www.baidu.com"); // 設(shè)置訪問網(wǎng)頁的URL curl_setopt($curlobj, CURLOPT_RETURNTRANSFER, true); // 執(zhí)行之后不直接打印出來 $output=curl_exec($curlobj); // 執(zhí)行 curl_close($curlobj); // 關(guān)閉cURL echo str_replace("百度","php",$output); ?>
submitReset Code