【发布时间】:2015-11-18 22:33:39
【问题描述】:
我想要来自 URL 的 HTML 代码。
实际上,我想从一个 URL 的数据中跟踪内容。
1. blog titile
2. blog image
3. blod posted date
4. blog description or actual blog text
我尝试了下面的代码,但没有成功。
<?php
$c = curl_init('http://54.174.50.242/blog/');
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
//curl_setopt(... other options you want...)
$html = curl_exec($c);
if (curl_error($c))
die(curl_error($c));
// Get the status code
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);
curl_close($c);
echo "Status :".$status; die;
?>
请帮我从 URL(http://54.174.50.242/blog/) 获取必要的数据。
提前致谢。
【问题讨论】:
标签: php url curl file-get-contents html-entities