Jump to content

Fopen Problem


emaw7

Recommended Posts

Hello,

 

I am having a problem with fopen on ONE of my servers. It works fine on all my other ones.

 

When i try to open a url in fopen, to check if it exists or not, it always returns true. It doesnt register the 404 like its supposed to.

 

Here is the test file i am using:

 

I have this file reading the stream of fopen and outputting it to the browser.

 

http://pvt-test.tooshocking.com/fopentest.php

 

If you notice it just grabs the 404 page instead of returning an error like the same code does on this server

 

http://media2.evilchili.com/adengage/fopentest.php

 

I can't find any information on why this would be doing this.

 

Can anyone here help me fix this?

here is the code i am using to test

 

	
<?php

$fp = fopen("http://media2.evilchili.com/content/blogs/pictures/Desert%20Landscape.jpg", "rb");
$file = fread($fp, 4096);
fclose($fp);
if($fp)
{
	echo "FILE";
}
else
{
	echo "NO FILE";
}

echo $file;
?>

Link to comment
https://forums.phpfreaks.com/topic/183650-fopen-problem/
Share on other sites

I have resolved this issue.

 

Seems the reason fopen was accepting a 404 as valid was beacuse fopen was using The cURL wrapper instead of the http.

 

I recompiled php to a newer version without curlwrappers enabled and now fopen functions as expected, with the http wrapper.

 

Thanks,

Link to comment
https://forums.phpfreaks.com/topic/183650-fopen-problem/#findComment-969434
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.