How to fetch top 20 results of particular keyword from AOL Search Engine using PHP?
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.
精彩评论