Archive for the 'PHP' Category

IP to country converter – using MaxMind GeoIP API

We’ve covered the HostIP.info API for converting the IP address to a country and city of your visitor. But you may have noticed sometime HostIP.info does not convert everything and might have comparatively lower accuracy. But if you want better accuracy, HostIP.info also recommends you to get a commercial version such as MaxMind

Continue reading ‘IP to country converter – using MaxMind GeoIP API’

How to get the country of an IP address in PHP?

The HostIP.info provides API allows you to get the country including the city as well. The simple PHP script that can get the country is as follow:

Continue reading ‘How to get the country of an IP address in PHP?’

PHP How-to: HTTP POST without using cURL

You wanna call a remote web service using HTTP POST in your PHP, but you do not wanna use cURL as cURL might not be supported in your web host. The following codes explain how you can do it without using cURL.

Continue reading ‘PHP How-to: HTTP POST without using cURL’

Web Hosting review blog

I’ve started a new blog, Have Your Business Online, which is a blog that centers around web hosting services, reviews, e-commerce and CMS solutions or the essential tools that you need to bring your business online.

Continue reading ‘Web Hosting review blog’

Convert documents into flash, a web-viewable format

One of my projects is studying on how to convert any documents in Word, Excel or Powerpoint formats into FLASH format which is viewable by most browsers with flash plugin.

Continue reading ‘Convert documents into flash, a web-viewable format’

To validate if an URL exists, use PHP CURL

PHP Curl allows you to validate if a given URL exists. What you need to do is just a simple function as follows, which takes an input URL and returns the code. If the returned code is 200, then the URL exists, else it doesn’t!

Continue reading ‘To validate if an URL exists, use PHP CURL’

How to shorten long URLs in a user-input text by using TinyURL programmatically

TinyURL allows long URL to be shortened. In this example, I’d like to show how you can build a text form that contains text keyed in by a user, and sends to the server-side PHP to detect those overly long URLs and shorten them one by one by sending them to TinyURL service.

Before I proceed, I’d like to let you know that TinyURL has an API, which is as follows and it returns a single string only that is the tiny url which has been shortened from the given “url” parameter.

Continue reading ‘How to shorten long URLs in a user-input text by using TinyURL programmatically’

Sorting data made easy using JavaScript table sorter

javascript-table-sorter
If you’re asked to build a PHP script that pumps out some data from the database and presents in an HTML table to the users. And on the first row of the table, shows the titles of each field (As pictured above). Once the user clicks on each title the data in the column need to be sorted. If you implement this in a server-side scripting such as PHP, it’ll then need to send the request back to the server to get the server-side PHP script to sort the data by changing the “ORDER BY” in an SQL statement.

Continue reading ‘Sorting data made easy using JavaScript table sorter’

A simple Java FTP connection + file download and upload

The Java or JDK comes with NO support of any official API for FTP connection. But there is an internal that comes in the sun.net package, but this is NOT well-documented, and you will hardly find how to use other methods within the sun.net.ftp.FtpClient class.

Continue reading ‘A simple Java FTP connection + file download and upload’

Compress JavaScript to speed up download : The online compressor for YUI

When building AJAX dynamic web applications you’ll have to load lots of JavaScript libraries, one of them will be the YUI, (Yahoo UI), which has a whole bunch of handy library components that you can use for Ajax and DHTML web apps.

Continue reading ‘Compress JavaScript to speed up download : The online compressor for YUI’