Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Can I use file(http://url.com) despite http header 400?

AOL encquery decoding script no longer works because http 400 header

1:26 am on Jul 4, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 23, 2007
posts: 48
votes: 0

I have been using this script to decode the AOL encquery parameter for some time:

if (stripos($url,"?encquery=") == TRUE) {
$pos = stripos($url,"?encquery=");
$query_url = substr($url,$pos+10);
$end_pos = stripos($query_url,"&");
if ($end_pos == null) {
$encoded_query = str_replace("+"," ",substr($query_url,0));
} else {
$encoded_query = str_replace("+"," ",substr($query_url,0,$end_pos));
$FU_AOL = implode( "", file( "http://search.aol.com/aol/search?encquery=$encoded_query" ));
preg_match( '/<title>[^>]*"([^"]+)"<\/title>/', $FU_AOL, $decoded_query );
$terms = $decoded_query[1];

This script was working fine up until about early May. The reason it stopped working is because the AOL url used in file() returns a http header 400. I did a random search on aol.com and checked the returned http header, and it returns 400 as well.

Is there anyway to get file() to work regardless of the returned header? Do I have any other options to load the AOL result page's source code into an array or variable?


4:25 am on July 4, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:July 6, 2005
posts: 121
votes: 0

other options:

[php.net...] and