Script help

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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(
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.


define('CACHEDIR', './');
$request =  ' show
$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);
  rename($tmpf, $dest_file);
 } else {
  return file_get_contents($dest_file);


Superb hosting & domain name deals
The Handyman

Superb hosting & domain name deals
The Handyman

Re: Script help (sorted)

To restore balance to the world Joker7  wrote in
Quoted text here. Click to load it

It script did not like the gaps in the url ..


Site Timeline