tags:

views:

27

answers:

2

Hi,all I want top 20 results of AOL search engine but I don't know how can I get using PHP script ?

Please Help me.

A: 

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

Priyank Bolia
A: 

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.

codaddict
then you have a bigger problem of parsing those results, which is a bad thing, when you can get results in your format directly. Not sure about AOL, but Google atleast provide results and on the dev.aol it looks like AOL also have web services to return the results.
Priyank Bolia
@Priyank: I did not find documentation about any such web-service. If a web service exits, its the way to go, else you can use simplehtmldom to simplify the parsing of the downloaded page.
codaddict