fsockopen() Premission denied 13
Moderator: General Moderators
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
fsockopen() Premission denied 13
Hey guys,
on a local server of mines im doing a whois is look up using the fsockopen function which returns successfully. However, on trying to use it on a live site. I get a PHP warning saying that it was unable to connect and also return the error string 'Permission denied' and the #13
any explanations on this? any work arounds?
Kendall
on a local server of mines im doing a whois is look up using the fsockopen function which returns successfully. However, on trying to use it on a live site. I get a PHP warning saying that it was unable to connect and also return the error string 'Permission denied' and the #13
any explanations on this? any work arounds?
Kendall
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I don't think whois services query (via a page) other services, most will use the system level request to a DNS server.
shell_exec() et al.
shell_exec() et al.
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
Ok you've thrown me off the track with that one man....what r you trying to say here? I don't know but I use fsockopen() as a tool to get whois information from a whois server. Its working on my local server but not on my live server. what does shell_exe() have to do with this?I don't think whois services query (via a page) other services, most will use the system level request to a DNS server.
shell_exec() et al.
Kendall
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
Code: Select all
$TLDservers = array("com"=>"whois.crsnic.net","net"=>"whois.crsnic.net","org"=>"whois.publicinterestregistry.net","info"=>"whois.afilias.info","biz"=>"whois.neulevel.biz");
//whois query
function LOOK_UP($server = false,$domain,$record = false){
$errno = 0;
$errstr = '';
// if look up record only
if($record == true){
//look up domain records
$record = checkdnsrr($domain);
return $record;
}else{
// look up domain registrants
$port = 43;
$fp = fsockopen($server,$port,$errno,$errstr,30);
if(!$fp){
//return $errstr.' '.$errno;
return false;
}else{
fputs($fp, "$domain\r\n");
while(!feof($fp)) {
$data .= fgets($fp,128);
}
fclose($fp);
}
//echo $data;
if($data != false)
return strstr($data,'Domain Name');
else
return false;
}
}
//print(LOOK_UP($_GET['server'],$_GET['domain'],$record = false));
?>and i get thatPHP Warning: fsockopen(): unable to connect to whois.crsnic.net:43 in
return $errstr.' '.$errno; //prints out Permission denied 13
Wait, this works on your local machine, but not on your hosting? If so there are some restrictions on remote connections on your hosting. I don't remember what the relevant settings are - but you can see if there is something apparent in phpinfo(). Does somebody know what hostings do to forbid socket operations and how to check if this is the case?