
May 11th, 2007 by

Jon Moffet
This is an example PHP code I wrote to demonstrate how to connect to Foxrate Currency Exchange server and retrieve the latest exchange rate.
The example uses The Incutio XML-RPC for PHP library. Please visit refer to Incutio XML-RPC Library Manual for further in-depth reference.
PHP:
-
require('IXR.inc.php');
-
-
// connect to foxrate.org currency exchange server
-
$client = new IXR_Client('http://foxrate.org/rpc/');
-
-
//make the currency exchange
-
if (!$client->query('foxrate.currencyConvert', 'USD', 'GBP',1000)) {
-
die('Error detected - '.
$client->
getErrorCode().
' : '.
$client->
getErrorMessage());
-
}
-
-
$response = $client->getResponse();
-
echo "USD1000 is currently equal to GBP " .
$response['amount'];
The demo shows you how to get the current value of USD 1000 in British Pound (GBP). Hopefully this example will be useful for you to build a working currency exchage webapp using foxrate.org api
Download the sample code here : foxrate_rpc_1.zip
Tags: xmlrpc, xml-rpc, foxrate, currency exchange, foreign exchange, web api, rpc
Posted in Uncategorized |
1 Comment »

May 10th, 2007 by

Jon Moffet
Opentracker is the most simple php bittorrent tracker that I came across. It only requires a single MySQL table to function and it is a fully compliant bittorrent tracker as outlined by Bram Cohen.
I've included Opentracker in this blog because of its simplicity that made it easy to be use as a reference implementation for your own home-brew tracker.
Download Opentracker
- opentracker.zip (local)
- opentracker.zip (mirror)
Important Notice Due remember that MySQL based bittorrent trackers are known to use many connections at the same time, and may cause your database server to choke in a shared hosting environment. You've been warned!
Tags: bittorrent, opentracker, torrent, torrents, php, php scripts
Posted in Uncategorized |
No Comments »

May 9th, 2007 by

Jon Moffet
This is an example of an enhanced contact form previously featured here and here . I've improved the contact form example to include Akismet spam protection in order to make it more resistant to spam attack.
Demonstration

The example includes :
- PHPMailer class for sending mail through your own SMTP server
- Akismet Anti-spam class
- Table-less contact form
Feel free to download the example to be used in your own application : plain_akismet.zip
Tags: contact form, php, php4, akismet, antispam, anti-spam, example, coding
Posted in Uncategorized |
2 Comments »

May 9th, 2007 by

Jon Moffet
Some web hosting provider such as e-ruang offers choices of using PHP4 or or PHP5 in their hosting. To avoid conflict with existing scripts, they will usually offer PHP 4 by default.
But for obvious reasons, you may want to use PHP5 as it supports more functionalities and more robust than PHP4. To enable PHP5 for your account, you need to create a .htaccess file containing :
CODE:
-
AddHandler application/x-httpd-php5 .php .php4 .php3 .phtml
Save the .htaccess file, and upload it to the root directory of your server.
Then upload a php file containing phpinfo() function to test whether PHP5 has been enabled or not. If the modification has not been successful then you should contact your web hosting provider and ask about the appropriate way to activate PHP5 functionality.
Tags: php5, php, web hosting, hosting
Posted in Uncategorized |
No Comments »

May 9th, 2007 by

Jon Moffet
Here is a well-written step-by-step tutorial on how to use SQLite in PHP 5. The tutorial was written by Ilia Alshanetsky and featured in Zend Developer Zone.
SQLite Introduction
For those who don't know, SQLite is a lightweight embedded database management system, it is available as the default database engine for PHP5. Due to its embedded nature, SQLite store its database on a single file and is significantly faster than MySQL. Backing up SQLite database is as simple as copying its database file to a backup media.
SQLite is an excellent choice for creating and deploying portable web application without the need to do complex db setups on target machines.
Tags: php, php5, sqlite
Posted in Uncategorized |
1 Comment »