[thelist] fopen on php failing

alex alex at deltatraffic.co.uk
Wed Feb 23 14:22:28 CST 2005



>Where is the variable '$link' being defined? If it is coming from the URL, use
>$_GET['link'], if it's coming from a POSTED form, use $_POST['link'].
>  
>

oh sorry, internally like:

$link = "http://www.chuzpe.us/index.php" ;

now all of a sudden, fsockopen is failing:

*Warning*: fsockopen(): php_network_getaddresses: getaddrinfo failed:
Name or service not known in
*/usr/local/home/httpd/vhtdocs/delta_000/public_html/regexp/strip2.php*
on line *5*

*Warning*: fsockopen(): unable to connect to www.yahoo.com:80 in
*/usr/local/home/httpd/vhtdocs/delta_000/public_html/regexp/strip2.php*
on line *5*
Resource temporarily unavailable (11)

<?php

$url = "www.yahoo.com";

$fp = fsockopen("$url", 80, $errno, $errstr, 30);
if (!$fp) {
   echo "$errstr ($errno)<br />\n";
} else {
   $out = "GET / HTTP/1.1\r\n";
   $out .= "Host: $url\r\n";
   $out .= "Connection: Close\r\n\r\n";

   fwrite($fp, $out);

   while (!feof($fp)) {
       $html .=  fgets($fp, 128);
   }
   fclose($fp);
}

echo strip_tags ($html, "<a>, <i>, <b>, <strong>, <p>, <h1>, <h2>,
<h3>, <h4>, <title>");

?>





More information about the thelist mailing list