jpschreibman
asked on
PHP; replace fsocketopen function with cURL
I am using PHP to connect to a WHOIS server to query a given domain name.
I am currently using this code:
=============
$fp = fsockopen(whois.whoever.co m,43);
fputs($fp, "domain.com\r\n");
$string="";
while(!feof($fp)){
$string.= fgets($fp,128);
}
fclose($fp);
=============
I need the same WHOIS response ($string) using cURL instead of fsocketopen.
Please advise.
I am currently using this code:
=============
$fp = fsockopen(whois.whoever.co
fputs($fp, "domain.com\r\n");
$string="";
while(!feof($fp)){
$string.= fgets($fp,128);
}
fclose($fp);
=============
I need the same WHOIS response ($string) using cURL instead of fsocketopen.
Please advise.
ASKER
Is it possible to use fsockopen via proxy? Is so, how?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Understood and thank you.
ASKER
I was attempting the impossible. Thanks anyway.
http://curl.haxx.se/
curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos...), file transfer resume, proxy tunneling and a busload of other useful tricks.
You will need to use fsockopen