Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Jul 2003
    Location
    aussie
    Posts
    2
    Member #
    2315
    well im quite no0b @ php, n i spent last few days searchin thru php.net 4 the answer 2 my question wif no luck.

    Q: can i, thus what is the code to check the avalibity status of a file which is located on a different server to that of my host?
    (i want to hav an online/offline alert next to a list of file mirrors i hav)

    thanx in adv

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    You can try requesting the file via HTTP headers, and then reading the headers you get back. If you get a 404, 403, 500, or other error, then it won't work.

    Because it would be server-intensive, you should have it run periodically, not each time the page is viewed.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Junior Member
    Join Date
    Jul 2003
    Location
    aussie
    Posts
    2
    Member #
    2315
    say waaaa?
    ok, so php wnt do that?
    sweet as thanx

  5. #4
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    I think you actually have to use PHP's socket interface for TCP/IP communications. That will allow you to determine if the file exists. I've never seen a script like that, but you can see the PHP socket API here:

    http://www.php.net/manual/en/ref.sockets.php

  6. #5
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Just a note... when you're doing TCP/IP communications, be sure to specify port 80 (the default HTTP port).


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:32 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com