Re: is_readable(http://.... text file) says not, but I can in browser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jan 11, 2009 at 13:07, John Allsopp <john@xxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxx || danbrown@xxxxxxx
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux