PHP supports libcurl that allows you to connect and communicate to many different types of servers with many different types of protocols.
libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, and user+password authentication.
Here's a quick scan of how I just wasted several days and couple of hours trying to integrate simple PHP curl codes with existing API backends from Enom and Namecheap. Currently Namecheap does not have publicly available integration interface that is as simple as 1-2-3 site installation.
Now the fun begins.
$url = 'API server host';
$curl;
$curl = curl_init();
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($curl, CURLOPT_URL, $url);
$result = curl_exec($curl);
curl_close($curl);
header('Content-Type: application/xml; charset=ISO-8859-1');
print $result;
By default, curl makes use of HTTP-GET unless explicitly specified to be false and as HTTP-POST method.
This PHP codes simply checks a specified particular domain TLD via PHP form, for the possibiblity of domain existence. That's it. As we all know, the free WHOIS and DOMAINTOOLS servers are limited by request for security reason, that is why this code has been created for some time. Note that the return results from Namecheap API server https://api.sandbox.namecheap.com comes in XML format.
Probability is, this is the same approach that has been utilized for desktop and web applications like twitter, entrecard, myblog, and even YMail and GMail - the difference is that the front-end differs, where a few of them enjoyed more of AJAX and SOAP. :) The rest are PHPs.
Furthermore, these codes can also be expanded to actually register domains, and even have a full-pledged DNS control and management system acting as domain registrar platform, like Godaddy, Namecheap, Onlinenic and Enoms.
For the docs.
Subscription
Categories
- HowTos (612)
- Linux Devices (40)
- Linux Diggs (620)
- Linux News (1541)
- Linux Videos (24)
Recent Posts
Saturday, June 20, 2009
How To Perform HTTP-GET via Curl Commands inside PHP
Subscribe to:
Post Comments (Atom)
ILoveTux - howtos and news | About | Contact | TOS | Policy
6 comments:
nice blog nice blog
Hello I ran into your BLOGspot after looking UP on Internet about Fedora 8 tips (k9Copy) .
Iam using Fedora 8 on my Desktop -with a Dual boot situation with Windows xp (2 harddrives) .
I was wondering if anyone here has installed TRANSCODE onto fedora 8 Successfully???
Regards -stuart smith
Hello thank you for letting me login .
Wiil be back in touch.
thanks -stuart smith
For Transcode, use rpmfusion-free repo
source - https://bitbucket.org/france/transcode-tcforge/downloads
Ok - thanks for the website linkage --but that bitbucket site has only Tar.gz type files NOT rpms,!!!
Ihave to go to LinuX schoolanf learnhow to do Tarball installation --or just pay some Tech to do it for me!!!
Post a Comment