Hi,
I am running a generator script that produces a HTML page for every result page in a DB. The HTML files are generated on an intranet server and then uploaded via PHP's FTP function.
I have a dropdown list of dates that are used to reach the HTML files. These are all on the same server which doesnt have PHP installed.
When the user clicks submit the date values are passed to a dateredirect script. This checks if the file exists and if it does it goes to that file, if it doesnt exist it goes to a "no results" page.
Now, the PHP file is on a different server from the files it is checking and this is where I am having the problem. Firslty, here is the dateredirect.php file
<?php
$newdate = $day.$month.$year;
$path = "http://xxxxxxxx/hr/html/
".$year."/".$month."/".$day."/track".$newdate.".html";
if(!fopen($path, "r")){ // this is line 5
header("Location: [url]http://xxxxxxxx/
hr/noresults.html[/url]");
}
else{
header("Location: [url]http://xxxxxxxx/hr/html/
[/url]".$year."/".$month."/".$day."/"."track".$newdate.".html");
}
?>
The $day, $month and $year variables are passed from a form and are used to get the file.
When I run this i am getting the following errors:
Warning: php_hostconnect: connect failed in c:\program files\nusphere\apache\htdocs\t\dateredirect.php on line 5
Warning: fopen("http://xxxxxxxxx/hr/html/2002/01/11/track11012002.html","r") - Bad file descriptor in c:\program
files\nusphere\apache\htdocs\t\dateredirect.php on line 5
Any help with this is appreciated.
I have checked and the file definitely exists, if i paste the URL given in the error into a browser I can get to it without any problems.
Thanks,
Martin