We help IT Professionals succeed at work.

PHP; replace fsocketopen function with cURL

jpschreibman
jpschreibman asked
on
980 Views
Last Modified: 2010-04-21
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.
Comment
Watch Question

Top Expert 2007

Commented:
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

Author

Commented:
Is it possible to use fsockopen via proxy? Is so, how?
Top Expert 2007
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Understood and thank you.

Author

Commented:
I was attempting the impossible. Thanks anyway.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.