php

Matthias Reuter's picture

The art of escaping

Escaping is the art of transforming a text into a transport format from which it can be extracted again without any modification.

That's something every developer does - to a certain level. For example take the sentence

Matthias says: "I love Javascript".

Now put this sentence in a Java source code:

String s = "Matthias says: "I love Javascript".";

If you don't complain about this, your compiler will. In Java (any many other programming languages) the quotation mark " has a special meaning, it defines a string. So if you have a string containing the quotation mark, you need to escape it:

String s = "Matthias says: \"I love Javascript\".";

If you print out s, the original text is shown:

System.out.print(s); // Matthias says: "I love Javascript".
Read more

Christian Harms's picture

Combining HTTP and JavaScript APIs with php

The implementation of the ip to geo location script started as a quick hack in php. Sometimes I use php scripts because everyone can include it in his own website account (but I am not an active php programmer). It's much easier to write a simple php script instead of deploying a more complex web application. The quick result was this implementation as an example. After getting the php script to work I rewrote it in python, transformed it into a google appengine application and deployed it. Both worked fine and now there are two examples for the API integration available.Read more

technorati code jxzmcfgp74
Christian Harms's picture

Tutorial for a IP to geolocation aggregator script

If you provide a restaurant guide it would be great to show the next restaurant based on webpage visitors position or the local beer garden specials if its sunny weather? Or offer geo targeted ads on your page? And this could be offered without registration or connection to a social network? I will describe the api/implementation details and offer directly our free "ip to geolocation aggregator"-script.

The first step is determining geo location based on Internet IP address of the visitor. I have found five free service providers which offer data based on the client-IP the geo position and city/country data. Classic "ip to geolocation data offers" are commercial. You have to buy and download a sql dump or csv file with ip ranges from isp with country and city data - some expanded with long/lat values. The second solution (and to save hosting space) is using a http api which offer theses data directly when being called - these looks like the preferred possibility. And the third way is to include a javascript which can integrate the geo position directly without need of a server component.Read more

Syndicate content