Link to home
Start Free TrialLog in
Avatar of jpschreibman
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.com,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.
Avatar of hernst42
hernst42
Flag of Germany image

not possible. curl does not support the whois protocol.

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
Avatar of jpschreibman
jpschreibman

ASKER

Is it possible to use fsockopen via proxy? Is so, how?
ASKER CERTIFIED SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Understood and thank you.
I was attempting the impossible. Thanks anyway.