Re: is_readable(http://.... text file) says not, but I can in browser
| From: | Daniel Brown | Date: | Sun, 11 Jan 2009 18:33:01 +0000 |
| Subject: | Re: is_readable(http://.... text file) says not, but I can in browser | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-286041@lists.php.net to get a copy of this message | ||
On Sun, Jan 11, 2009 at 13:07, John Allsopp <john@johnallsopp.co.uk> wrote:
>
> Thanks, that worked a treat except I was getting warnings on 404. I looked
> around for solutions to that and it appears curl might handle that better,
> so I'm currently working on that. Many thanks tho .. let me know if you know
> how to stop the warnings :-)
If you want to stop the warnings and verify that data exists, you
can just modify that code like so:
<?php
$myFileLast = "http://www.isawit.com/ffindex.php";
$theDataLast = (strlen($tmpData = @file_get_contents($myFileLast))
> 0) ? $tmpData : sprintf("File not found.");
?>
Then you can modify it to read generated error pages (such as
Apache's stock 404 page) through a simple regexp or other method to
verify that the file is what you expect it to be.
--
</Daniel P. Brown>
daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!