Page 1 of 1

Convert fsockopen to curl

Posted: Thu Feb 25, 2010 6:43 am
by klevis miho
How to convert this:

$fp = fsockopen($whois_server,43);

into a curl?

Re: Convert fsockopen to curl

Posted: Thu Feb 25, 2010 7:57 am
by Weirdan
klevis miho wrote:How to convert this:

$fp = fsockopen($whois_server,43);

into a curl?
cURL is not supposed to replace such requests. From their docs:
curl is a command line tool for transferring data 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.
libcurl (used by both command-line curl and php's curl extension) is an underlying library which performs aforementioned tasks - and thus it's not suitable to work with a protocol it does not support, like whois.

Re: Convert fsockopen to curl

Posted: Thu Feb 25, 2010 8:08 am
by klevis miho
Yeah thank you man, I've just read that cURL cannot handle whois requests :(