News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

php|architect:
Geolocation Easier Than It Looks
November 08, 2011 @ 08:03:21

On the php|architect site Jeremy Kendall has a new article looking at geolocation in PHP and how, despite some comments in the past about its difficulty, some more recent tools make it relatively simple.

Have you ever wanted to add location-aware content to your web applications? Would you believe me if I told you it was dead easy, and you could be up and running in about 10 minutes? The first thing you want to do is use someone else's work. Geolocation is a solved problem; there's no need to roll your own. I went searching for free Geolocation APIs and found two I wanted to try: MaxMind's GeoLite API and Quova.

He briefly introduces each data source - GeoLite as a downloadable database and Quova as an API. Sample code is included for using the data from both of these services to find a location based on an IP address. He does include one caveat though - be careful about accuracy, they usually only promise things to be within 25 miles of the spot you're actually looking for.

0 comments voice your opinion now!
gelocation ip geolite quova tutorial pear package


Kevin Schroeder's Blog:
You want to do WHAT with PHP? Chapter 1
August 26, 2010 @ 11:03:27

Kevin Schroeder has a new post today with an excerpt from his book "You Want to do WHAT with PHP?" - the first chapter looking at networking and socket connections.

I'm also woefully behind on blogging. So, to alleviate that I am going to post an excerpt from my upcoming book "You want to do WHAT with PHP?" Today we are going to take a look at Chapter 1.

The sample chapter talks about figuring out the host to netmask relationship relationship by parsing the IP with the ip2long and comparing that to the list of netmasks from an array. Sample code is provided as well as output for reference.

0 comments voice your opinion now!
book excerpt networking sockets netmask ip


DevShed:
Validating IP Addresses with Filters in PHP 5
August 26, 2009 @ 15:52:05

DevShed has posted the seventh part of their "validator" series today. This time they look at validating IP addresses with the filter_var function.

You can surely appreciate this functionality when developing modules, classes, plug-ins, etc. that must perform some kind of strong validation on incoming data. The filter extension comes armed with another handy filter, though, that permits you to check some common things, such as the IP addresses of client machines.

The give an example of using the FILTER_VALIDATE_IP constant to check the IP address format and include the optional FILTER_FLAG_IPV4 check for the IPv4 format.

0 comments voice your opinion now!
validate filter ip address tutorial


Paul Gregg's Blog:
PHP algorithms Determining if an IP is within a specific range.
April 28, 2009 @ 09:25:39

Paul Gregg has shared a method he's come up with to determine if a given IP is within a selected range.

Unfortunately although people usually understand that an IP address is simply an unsigned 32 bit integer, and is easily determined, usually with $_SERVER['REMOTE_ADDR'], where the real challenge is - is in specifying the range within which they wish to check that IP address. IP ranges are usually specified in three common ways (in increasing complexity): wildcard, start-end range, classless inter-domain routing.

He looks at each method and includes descriptions and code examples as well as a link to the source code and a live demo of it in action.

0 comments voice your opinion now!
algorithms ip address specific range three method wildcard cidr startend


DevShed:
Using Code Igniter to Build an IP-to-Country Mapping Application
February 25, 2009 @ 07:57:11

DevShed finished off their tutorial series looking at mapping IPs to countries in a CodeIgniter application with this new article completing the application to provide a correct products list based on their location.

In this final chapter of the series, I'll be discussing how to build multi-lingual web pages by combining the functionality brought by the "iptocountry" MySQL table that you learned in previous tutorials and the power of the Code Igniter PHP framework.

Their database tables sort the prodcuts out with the three character country code they're associated with. The IP-to-country tables then help with the translation between the visitor's IP address and which products should be shown.

0 comments voice your opinion now!
country ip mapping products codeigniter framework


Nessa's Blog:
Simple API Writing, Part I
February 11, 2009 @ 12:08:11

Nessa has started off a series looking at writing your own API with part one posted recently focusing on the client-side first, writing an interface for their API.

Though in real applications you wouldn't need an API, all you'd need is a PHP script that accepts GET or POST input to perform some kind of action. In this example, we'll have a script that automatically adds DNS zones to a nameserver that runs cPanel as well. Most APIs do the same thing - you have a script, then that script accepts post/get variables, then does something.

Her example creates the request - a server, path, IP and hash key - and sends it off to the remote system. The result is pulled back in and parsed through a SimpleXML object. The credentials allow for access lists and a bit of security on the backend.

0 comments voice your opinion now!
api interface client use remote system hash ip simplexml cpanel


DevShed:
Building Sample Programs for an IP-to-country Mapping Application
February 11, 2009 @ 08:44:29

DevShed has posted the second part of their series looking at an IP-to-Country mapping application, this time with a focus on building some simple applications to use the data inside.

Building a web site that will be seated on a multi-lingual platform often requires developing an IP-to-country application that permits you to map users' IP addresses to their corresponding countries. [...] This database contains over 82,0000 records and allows you to map more than 3,200,000 IP addresses to their respective countries. This can be really handy for developing different IP-to-country applications with minor efforts.

The review the previous article on making the database and move ahead to create a script that selects - based off the IP range - the country that address could be from.

0 comments voice your opinion now!
ip translate country mapping application program tutorial


DevShed:
Building an IP-to-Country Mapping Application with PHP
February 04, 2009 @ 08:47:30

DevShed has launched a new four-article series today looking at resolving a user's IP to their country via the database provided here.

If you have content in several different languages, your visitors probably speak several different languages as well. Wouldn't it be nice to serve them content from your site in their native language, based on the country from which they hail? You can, even if you're a small company, with an application that tells you a visitor's country based on their IP address. This four-part article series will show you how to build the application and incorporate it into your web site.

They just get things set up in this first part of the series - grabbing the CSV file from the site, creating the MySQL table to import it into and running a script to parse the CSV and push its data into the table.

0 comments voice your opinion now!
tutorial ip country mapping csv database mysql


Nexen.net:
PHP Statistics for October 2008
November 07, 2008 @ 14:39:54

Damien Seguy has passed on the latest PHP statistics for October 2008 on the nexen.net site. Here's a few highlights:

  • This was the last month of PHP 4 dominance
  • PHP 5 tops PHP market share with 47.50% usage
  • PHP 4.4.9's usage is moving even lower

The full stats (including graphs) can be found here and the evolution stats are here.

0 comments voice your opinion now!
statistic usage domain ip php4 php5 october08


Toomas Romer's Blog:
Case study Is PHP embarrassingly slower than Java?
August 04, 2008 @ 12:02:05

In a case study posted to his blog, Toomas Romer wonders if a PHP script is embarrassingly slower than than its Java counterpart.

The problem. The PHP implementation [of the IP2C library] is a lot slower. Embarrassingly slower. Without any caching the Java version is able to do ~6000 queries per second. The PHP counterpart can push through ~850 queries. The implementations are the same. The stats provided by the author of the library are 8000 vs 1200. So about the same as my measurements.

He details the script, showing what parts the script is taking up the most time on. A large part of the execution is tied up in IO and the fseek/fread and readShort/readInt functions take up a good chunk.

He even tries removing the functions and making things a bit more streamlined. This helps, but still lags behind its Java brother. Check out the post for more statistics comparing the two.

0 comments voice your opinion now!
casestudy slower ip2c ip country resolution java compare benchmark



Community Events





Don't see your event here?
Let us know!


application community threedevsandamaybe language series podcast api code list wordpress configure bugfix developer unittest library install interview release introduction laravel

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework