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

Am trying to implement a certain code to automatically check if the url is valid or not…
here is the script…
$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
[COLOR=DarkRed]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[/COLOR]

how can i solve the 1st and the 2nd problem… thnx :slight_smile:


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.

i used fp=@fopen($url,‘r’) instead… and it works 4me thanx