Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

PHP; replace fsocketopen function with cURL

Posted on 2007-10-06
5
Medium Priority
?
945 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.
0
Comment
Question by:jpschreibman
  • 3
  • 2
5 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 20026983
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
0
 

Author Comment

by:jpschreibman
ID: 20026988
Is it possible to use fsockopen via proxy? Is so, how?
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 2000 total points
ID: 20026991
You can use fsockopen to connect to the proxy and then issue the proxy commands to connect to whois server and get the data. So instead of connection to the whois-server you connect to the proxy. Btw a http-proxy will not work for this you need a socket proxy.
0
 

Author Comment

by:jpschreibman
ID: 20026996
Understood and thank you.
0
 

Author Closing Comment

by:jpschreibman
ID: 31408056
I was attempting the impossible. Thanks anyway.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question