Saturday, June 20, 2009

How To Perform HTTP-GET via Curl Commands inside PHP

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.

Friday, June 19, 2009

Fedora 11 - HTML Doc Installation

Have you ever needed a tool that converts HTML source files, into indexed HTML, or adobe postscripts or even to adobe PDF files? Here's a quick post on how to convert HTML files into indexed HTML, postscript or adobe PDF file.

What is HTMLDOC?

HTMLDOC converts HTML source files into indexed HTML, PostScript, or Portable Document Format (PDF) files that can be viewed online or printed. With no options a HTML document is produced on stdout. The second form of HTMLDOC reads HTML source from stdin, which allows you to use HTMLDOC as a filter. The third form of HTMLDOC launches a graphical interface that allows you to change options and generate documents interactively.

HTMLDOC converts Hyper-Text Markup Language ("HTML") input files into indexed HTML, Adobe® PostScript®, or Adobe Portable Document Format ("PDF") files.

HTMLDOC supports most HTML 3.2 elements, some HTML 4.0 elements, and can generate title and table of contents pages. The 1.8.x releases do not support stylesheets. HTMLDOC can be used as a standalone application, in a batch document processing environment, or as a web-based report generation application.

How To Install HTMLDOC into Fedora 11?

HTMLDOC Installation on Fedora

HTMLDOC is supported by Fedora 11 yum repos. To install, simply

# yum -y install htmldoc

The above command will also install C++ user interface toolkit called fltk.

HTMLDOC Usage

Executing HTMLDOC binary launches a GUI window where in you can customize its default settings and feed in the required input files and eve specify the output file as shown from the captured HTMLDOC window below

# htmldoc

Monday, June 8, 2009

Fedora 10: How To Install and Integrate Sun Java on x64 Systems

In order to instal Flash on 64-bit Fedora 10 linux, here's a quick guidelines on how to install macromedia flash x64 to Firefox under Fedora 10 OS.

Fedora 10: How To Install Flash x64 with Firefox

1. Download Sun Java's Linux x64 bit rpm here.
2. Chmod 700 jre-6u13-linux-x64-rpm.bin
3. ./jre-6u13-linux-x64-rpm.bin

The above now shows the License and Agreement. Press 'q' to proceed and type 'yes' to agree.

4. Issue these commands.

# update-alternatives --install "/usr/bin/java" "java" "/usr/java/jre1.6.0_12/bin/java" 20000
# update-alternatives --set java /usr/java/jre1.6.0_12/bin/java
# ln -sf /usr/java/jre1.6.0_12/lib/amd64/libnpjp2.so /usr/lib64/mozilla/plugins/
# mozilla-plugin-config -g -c -v

5. Restart Firefox and head on here to test your Sun Java's Fedora 10 installation.

6. To verify Mozilla plugin integration, type

about:plugins

from the address bar and confirm that you are seeing lines as shown:

libnpjp2.so

File name: libnpjp2.so

MIME Type Description Suffixes Enabled
application/x-java-vm Java Yes
application/x-java-applet Java Yes
application/x-java-applet;version=1.1 Java Yes
application/x-java-applet;version=1.1.1 Java Yes


Works great.

Saturday, June 6, 2009

Fedora 11 vs Ubuntu 9.04 Boot Speed

I was crawling from youtube's side by side linux videos and suddenly, as we always expect it, wonder video comes along. Here's a side by side boot sequence video comparison of the upcoming Fedora 11 and Ubuntu 9.04 distributions.





Fedora 11 rocks ofcourse. Personally, the only thing Ubuntu is better because its easier specially for linux noobs and newbies.

Fedora 10 Reviews

Chris goes over some of the top features of the Fedora 10 release. He addsvisual overviews of some of the new improvements!



Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy