开发者

Fetching data from another website

I am making a new website using PHP and I want to fetch the data from another website in which I have my profile, which contains wallpapers, logos etc.

I want to fe开发者_开发百科tch the data from that website and display it on my new website in the content section.

Please give me some ideas on how to do this task in PHP.

Thanks in advance.


See e.g. the curl extension or the http wrapper for retrieving the content.

See the DOM extension for parsing the HTML.


You could use cURL to send requests to the remote site and fetch the results.


Depending on the who the site is, they may have provided an API for accessing that info. That generally applies for larger sites like facebook and such.


You can use cURL to make a web request to a web address and get the HTML back.


PEAR::HTTP_Request

// Fetches yahoo.com and displays it
require_once "HTTP/Request.php";

$req =& new HTTP_Request("http://www.yahoo.com/");
if (!PEAR::isError($req->sendRequest())) {
    echo $req->getResponseBody();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜