SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist perpetual_dream's Avatar
    Join Date
    Nov 2005
    Location
    Jerusalem
    Posts
    542
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unable to find the socket transport "http" when checking url..

    Hey...
    Am trying to implement a certain code to automatically check if the url is valid or not...
    here is the script.....
    $downloadlink1=$_REQUEST['downloadlink'];
    $fp=fsockopen($downloadlink1,80,$errno, $errstr, 30);
    if (!$fp) {
    echo " the url specified isnt correct";
    }
    i keep getting this error if the url starts with http... "unable to connect to http://:80 (Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?) " + the script doesnt work if id like to check a file for example http://www.pctools.com/downloads/sdsetup.exe ... it gives the following errors
    Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\Apache Group\Apache2\htdocs\downloadsite\insertenglish.php on line 12

    Warning: fsockopen() [function.fsockopen]: unable to connect to www.pctools.com/downloads/sdsetup.exe:80 (Unknown error) in C:\Apache Group\Apache2\htdocs\downloadsite\insertenglish.php on line 12


    how can i solve the 1st and the 2nd problem... thnx
    Tanzeelnet - Best arabic downloadsite
    Linux Hosting |Free Downloads |

  2. #2
    SitePoint Evangelist perpetual_dream's Avatar
    Join Date
    Nov 2005
    Location
    Jerusalem
    Posts
    542
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nobody?
    Tanzeelnet - Best arabic downloadsite
    Linux Hosting |Free Downloads |

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thats not how you use fsockopen()
    please see the manual for more info, check out the user comments.

    basically, you cant feed a full uri as the target parameter.
    you need to feed it www.example.com and then you need to specify the path/filename as part of the headers, and you probably want to specify it as a GET(or preferably HEAD) request. then you need to parse the response headers to find the servers response code.

    you could also just use fopen() and it would make it a lot simpler, although probably not as efficient.

  4. #4
    SitePoint Evangelist perpetual_dream's Avatar
    Join Date
    Nov 2005
    Location
    Jerusalem
    Posts
    542
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i used fp=@fopen($url,'r') instead... and it works 4me thanx
    Tanzeelnet - Best arabic downloadsite
    Linux Hosting |Free Downloads |


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •