开发者

How to fetch top 20 results of particular keyword from AOL Search Engine using PHP?

开发者 https://www.devze.com 2022-12-14 13:58 出处:网络
I want top 20 results of AOL search engine but I don\'t know how can I get usi开发者_Go百科ng PHP script ?

I want top 20 results of AOL search engine but I don't know how can I get usi开发者_Go百科ng PHP script ?

Please Help me.


AOL has API to do that: You need to check the docs, like I got one example on internet for ASP.NET: http://dev.aol.com/aspnet-aolvideo-part1


First encode the search keyword:

$query = urlencode("YOUR_SEARCH_KEYWORD");

Next construct the URL in the following format:

$URL = "http://search.aol.com/aol/search?query=$query";

And then fetch the page for this URL using file_get_contents() function:

$file = file_get_contents($URL);

This page has 10 results, to get the next 10 results just change the url as:

$URL = "http://search.aol.com/aol/search?query=$query&page=2";

Fetch the file again and this has the next 10 results.

0

精彩评论

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

关注公众号