Re: best function to use ~ file_get_contents or ?

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

 



On Wed, 2009-09-16 at 12:08 +0530, Gaurav Kumar wrote:
> There is no best function as such. Everything depends upon your requirement.
> 
> You can also use fopen() to get the contents of the remote file and do some
> error handling that if you get any content then display image else a message
> etc..
> 
> Gaurav Kumar
> (Team Lead- open source)
> oswebstudio.com
> 
> 
> 
> On Wed, Sep 16, 2009 at 4:06 AM, CRM <crm@xxxxxxxxxxxxxx> wrote:
> 
> > Hi All,
> > Not sure of the best approach, need your feedback. I have 4 images on a
> > website. These are used in navigation. When I load a reference webpage on
> > my
> > local machine the local page calls 4 images from an external website, each
> > image will be on a different domain.
> >
> > What I want to see is if the navigation images/buttons can be
> > loaded/displayed
> > in my browser. If they can, then I will display the images on my local
> > page.
> > If the images cannot be loaded, then this indicates some connection issue
> > and
> > the result will be some text like 'Site Offline'. So just by glancing at my
> > local machine reference page I can tell if one or more of the different
> > sites
> > is or is not available.
> >
> > So what is the best function to use?
> >
> > if ( @file_get_contents( DOMAIN_PATH .
> > "images/navigation/nav_globalissa.png" )):
> >
> > or ???
> >
> > Please also cc info@xxxxxxxxxxxxxx
> >
> > Thanks for any helpful suggestions.
> >
> > Sincerely,
> >
> > Rob
> > Global I.S. S.A.
> > Software Powers the Net
> > Email: crm at globalissa dot com
> >
> > * * * The Forge of Globalissa ~ PHP Foobar Machine * * *
> > http://globalissa.com/forge/
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
The way I've always seen this approached before is by using the wget
command, which can be asked to just return the headers for a page. In
your case you'd be looking for all 200 codes, which means that all the
sites are up. This is faster than asking to return a full image each
time.

Thanks,
Ash
http://www.ashleysheridan.co.uk




-- 
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