Jump to content

Includes - but different servers


matfish

Recommended Posts

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

   fwrite($fp, $out);
   while (!feof($fp)) {
       echo fgets($fp, 128);
   }
   fclose($fp);
}
?> 

 

 

http://uk.php.net/fsockopen

 

Hi, thanks for the reply.

 

I get:

 

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in [location of file] on line 17

 

Warning: fsockopen() [function.fsockopen]: unable to connect to [file location].php:80 in [header location] on line 17

Success (0)

 

 

You think my hosts may not be allowing the connection?

 

Thanks again

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"http://www.domain.com/dir/include_file.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result=curl_exec ($ch);
curl_close ($ch);
echo $result;

 

the above doesnt work either but doesnt show any errors, does this mean curl is not installed on the host? Will take a week to get a reply from them!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.