Convert fsockopen to curl

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Convert fsockopen to curl

Post by klevis miho »

How to convert this:

$fp = fsockopen($whois_server,43);

into a curl?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Convert fsockopen to curl

Post 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.
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: Convert fsockopen to curl

Post by klevis miho »

Yeah thank you man, I've just read that cURL cannot handle whois requests :(
Post Reply