Login   Register  
PHP Classes
elePHPant
Icontem

Fix IP error (could not resolve the host domain)

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP HTTP protocol client  >  All threads  >  Fix IP error (could not resolve the host domain)  >  (Un) Subscribe thread alerts  
Subject:Fix IP error (could not resolve the host domain)
Summary:could not resolve the host domain xx.com
Messages:2
Author:mdchinese
Date:2012-02-28 15:21:49
Update:2012-02-28 17:53:46
 

  1. Fix IP error (could not resolve the host domain)   Reply  
Picture of mdchinese
mdchinese
2012-02-28 15:21:49
If the domain name does not get the IP, could not get data

FIX http.php
1:
old:
if(strlen($ip)==0
|| (strlen($this->exclude_address)
&& !strcmp(@gethostbyname($this->exclude_address),$ip)))
return($this->SetError("could not resolve the host domain \"".$domain."\"", HTTP_CLIENT_ERROR_INVALID_SERVER_ADDRESS));



After:
if(strlen($ip)==0
|| (strlen($this->exclude_address)
&& !strcmp(@gethostbyname($this->exclude_address),$ip))){
/*fix: ip error*/
$this->OutputDebug("could not resolve the host domain \"".$domain."\"");

==============================================================
2.

old:
if(($this->connection=($this->timeout ? @fsockopen($ip, $port, $errno, $error, $this->timeout) : @fsockopen($ip, $port, $errno)))==0)

After:

/*fix&:If the IP is empty the call HOST_NAME*/
if(trim($ip)==''){
$ip = $host_name;
}
if(($this->connection=($this->timeout ? @fsockopen($ip, $port, $errno, $error, $this->timeout) : @fsockopen($ip, $port, $errno)))==0)



  2. Re: Fix IP error (could not resolve the host domain)   Reply  
Picture of Manuel Lemos
Manuel Lemos
2012-02-28 17:53:46 - In reply to message 1 from mdchinese
This is odd. If the domain does not resolve to an IP address fsockopen is not able to connect anywhere.

Can you give an example of a domain that does not resolve to an IP address so I can see what fsockopen does?