Script help



Hi,
I have been using the code below for sometime and it works fine for most of
my need apart from this.
Im using it to request a page from (see code) and it keeps returning:

"Warning: file_get_contents(http://s.afnt.co.uk/df/df.aspx?a=13548&q=westend
show tickets&n=10&t=itpd1.xsl&r=) [function.file-get-contents]: failed to
open stream: HTTP request failed! HTTP/1.1 400 Bad Request in
/home/sites/test/call.php on line 46
Request failed"

Any help\pointers with this would be great.

<?php

error_reporting(E_ALL);
define('CACHEDIR', './');
$request = 'http://s.afnt.co.uk/df/df.aspx?a=13548&q=westend show
tickets&n=10&t=itpd1.xsl&r=';
$cache_filename = 'info.htm';
$cache_fullpath = CACHEDIR.$cache_filename;
$cache_timeout = 60;
$response = request_cache($request, $cache_fullpath, $cache_timeout);
if ($response === false) {
die('Request failed');
}
echo htmlspecialchars($response, ENT_QUOTES);
$file = "/home/sites/test/info.htm";

if (! chmod($file, 0776)) {
echo ("Unable to change file permissions");
}
function request_cache($url, $dest_file, $timeout=60) {
if(!file_exists($dest_file) || filemtime($dest_file) < (time()-$timeout)) {
$data = file_get_contents($url);
if ($data === false) return false;
$tmpf = tempnam('/tmp','YWS');
$fp = fopen($tmpf,"w");
fwrite($fp, $data);
fclose($fp);
rename($tmpf, $dest_file);
} else {
return file_get_contents($dest_file);
}
return($data);
}

?>


Superb hosting & domain name deals http://dn-22.co.uk
The Handyman http://www.looker.me.uk

--
Superb hosting & domain name deals http://dn-22.co.uk
The Handyman http://www.looker.me.uk


.



Relevant Pages

  • dhclient doesnt respond to DHCP OFFER
    ... It has two pcmcia nework cards - one connected to ... Echo (ping) request ...
    (comp.os.linux.networking)
  • Re: Re: How to get an parameter from a remote php script?
    ... > echo $t; ... > does something with this request.. ... > Or, in case you don’t need to store the remote file in a variable, ... Visit Topic URL to contact author (reg. ...
    (comp.lang.php)
  • Re: [PHP] Cant fetch HTTP POST data in PHP?
    ... why was the request a GET request rather than a POST request? ... echo $_POST; ... Chris Shiflett - http://shiflett.org/ ... PHP Security Handbook ...
    (php.general)
  • Re: ssh on ping port?
    ... REQUEST and receives ICMP ECHO REPLY. ... Please do not confuse an icmp packet with a tcp and/or udp packet. ... The icmp protocol do NOT use the notation of ports, instead the icmp protocol is divided into different types where echo request is type 8 and echo reply is type 0. ... Both will use port 7 if that is what /etc/services says to use. ...
    (alt.os.linux)
  • Re: So you think you are (or wanna be) a hacker
    ... >>properly calculating the amount of storage to request takes care of that. ... use snprintf or do something else. ... summer@Dolphin:~$ echo $HOME ...
    (Debian-User)