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
Archive for the 'PHP' Category
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:
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.
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.
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!
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.
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.
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.