Postcode/Location search - PHP - php

Sorry for this one but I'm lost. I'm trying to build a search page that uses either a UK Postcode or location to find an airsoft site (Lets call them "stores" so I don't have to explain to those who don't know what airsoft is), every store I have included a column Geo_location_lat & Geo_location_long alongside postcode, county, town/city and address where possible.
However I'm struggling to figure out how I go about taking the user input of "London" or "ST15" convert that to long/lat and search for all stores that fall within "X" radius. I have done a fair bit of googling and one or two scripts that are incomplete or require license.
Seen I can do it via Google API but they all involve markers and so on and I don't require maps etc... Unless I am missing a trick somewhere...
TL;DR - I need a store locator, all "stores' have long/lat stored already however not sure how to do the search.

Have a look at Ordnance Survey's OpenData API. Code-Point Open looks like it might be good for you: http://www.ordnancesurvey.co.uk/oswebsite/products/code-point-open/index.html

Google's API should do the trick for you. You want the geocoding API, not the maps one.
https://developers.google.com/maps/articles/geocodestrat

Related

Associate Adwords info with Contacts / Conversions on my website

My company run ads on Adwords for quite a while now.
We provide a special kind of Construction Services.
Since our solution is very complex, some people dont quite understand what we are offering but convert into a contact anyway. This happens because:
1 - They dont read the FAQ, neither the website content.
2 - They are just collecting quotes for a service they need, and just Copy + Paste their question on our Contact Form.
3 - Our service name is very hard to target correctly since the keyword is kind of "open to interpretation" and has a bunch of meanings.
I could exemplify with the keyword but i dont know the exact translation to english.
Anyway, we receive a bunch of Contacts. I can track conversions on AdWords and Analytics, i can see wich campaings, keywords, placements, etc are perfoming well, but here is what i really need:
I need to know where THAT GUY that wrote that stupid question came from.
I need to be able to associate AdWords data with the E-mails i receive trough the Contact Form.
I need to be able to, at the end of the month, collect those 1.000 contacts from my CRM wich are classified as "bad contact" and check where they came from. I could for instance find out that a specific placement in Display Network simply suck, i get conversions, but those conversions are bad. Or maybe a specific keyword simply dont work, people always mistake that for something else.
I need to be able to look at this very good contact that came in and trace it back to exactly what campaign originated it, what keyword, what search term, etc.
At my disposal i have, of course, AdWords resources - i looked everywhere i could not find how to do it with Adwords only.
I also have a CodeIgniter / PHP Website. Maybe there is a way to read AdWords / Analytics cookies.
I also have knoledge to mess up with the Adwords API, in case that helps.
Any help from you guys is welcome.
Sorry for my english - not my first language.
Best regards.
You might try using eCommerce module for analytics. Every time when the conversion is performed, create a new product and fill the fields (SKU, Price, Order ID, etc.) with data you need to identify contact

How does one go about incorporating location based services into a social network?

I am currently working on a special interest social network. The part that I'm having trouble with is the location of individual users.
My ideal solution would be a system where users enter their city/state and/or zip code, and could search for other users within their own area.
What I think separates my question from many existing threads is my needs and my resources. I don't have much capital at all to invest in a paid database, nor do i need all the features offered by the ones i've come across. I'm really looking for suggestions in which direction I need to go in. I've seen a lot of threads with similar ideas, but none that give the type of answers i need for my project. I'm not sure where to start with this, so any help would be greatly appreciated!!
Also, I'm building my application in php5.
these barebones hosting packages include MySQL... 1and1.com
so you could store the locations, and use the Haversine formula to find nearby users: http://code.google.com/apis/maps/articles/phpsqlsearch.html#findnearsql
For getting the data in Lat/Lng format, you could consider using navigator.geolocation...it's fairly well supported, but you could do a test for it: if(navigator.geolocation) and if it's NOT, provide a text field for city/state or ZIP, and then geocode that to get to Lat/Lng (google has a service here: http://code.google.com/apis/maps/documentation/geocoding/ ) but it does have some limitations, like 2500 queries/day unless you pay for an upgraded license
Actually, even if the navigator approach is available, you might want to provide a confirmation step (in case their ISP is returning an different location)...like "you appear to be HERE, is this accurate, or would you like to supply your own location"
Thank you Robot Woods, Your answer inspired some creative googling that lead me to the answer to my problem. Yahoo offers PlaceFinder! http://developer.yahoo.com/geo/placefinder/
PlaceFinder can be used to get a Latitude/Longitude from a user inputted city/state combination or a zip code. And best of all... Its Free!!! Fits my budget perfectly!

How to make a PHP based script for finding UK addresses by entering postcode?

I've almost looked everywhere but nothing found, so my only hope would be here though! :(
I want to make a PHP based script for finding UK address by entering postcode, so a list would show with a number of houses' numbers!
Any idea how I could do that, I know that I must use API, even though I search for Google Maps API for this, but nothing found whatsoever!
Any idea?
I need this particular script for an additional registration script which allows uk residents to be able to register for a specific reason, so please help if you know where I could get started!
Thanks in advance! :)
Generally these systems utilise the Royal Mail PAF database, but this does cost quite a lot of money.
There are services out there that offer X amount of requests for a set price (or a monthly price), so if buying the full thing isn't an option then you could have a look into one of those services.
It is something you are going to need to spend money on though - it's not a service that anyone (that I've ever found) is offering for free.
I don't think this is something you can get out of Google maps either.
Well, there are quite a few projects working on this dataset - just look at e.g. http://www.freethepostcode.org/ and the associated projects.
You can fetch the postcode latitude and longitude using google api:
http://maps.googleapis.com/maps/api/geocode/json?address=(POSTCODE HERE)&sensor=false
then using the lat and long from that you can get the street name
http://maps.googleapis.com/maps/api/geocode/json?latlng=(LAT),(LNG)&sensor=false
see reference here:
http://code.google.com/apis/maps/documentation/geocoding/
We can get all UK addresses by postal code with api.getaddress.io API. You can found an example on https://usingphp.com/post/how-to-get-all-uk-addresses-by-postal-code

Recommend a web service that handles location within a specific radius?

We have a client that wants a store locator on their website. I've been asked to find a webservice that will allow us to send a zipcode as a request and have it return locations within x radius. We found this, but it's maintained by a single person, and doesn't look like it gets updated or supported very well. We're looking for something commercial, ideally that updates their zipcode database at least once per quarter, and that has a well-documented API with PHP accessibility. I won't say price isn't an object, but right now we just want some ideas, and my google-fu has failed me.
I've already posted this over on the webmasters forum, but thought I'd cover my bases and post here too.
I've repurposed this outstanding script to conquor this same challenge. It's free, has been very reliable, and is relatively quick.
In my script, I have addresses stored in the DB. So rather than show a page to enter addresses, I simply pass them as a string and let the magic happen.
He says it in the app, but ensure that if you go this route you get your own Google Maps API. It won't work with his!
If you want to go a bit less technical approach, here's a MySQL query you could run on your locations (you'd have to add lat/long to your DB or setup a GEOCODING service) to give you distance as the crow flies.
Google Maps has a geocoder as well and it geocodes to the specific address.
It's limited to x number of requests but that shouldn't be a big deal if your site is small and if you cache. You can get more requests if you pay.
It can be accessed via javascript or via PHP (and there are several prewritten PHP modules out there)
Link here:
http://code.google.com/apis/maps/documentation/javascript/v2/services.html
(I worked for a company that did upwards of 800,000 requests a day, so it's stable and fast :) )
PostcodeAnywhere has a Store Locator feature - I think it's pay per use, but I've used their other products before and they're very cheap.
http://www.postcodeanywhere.co.uk/store-locator-tool/

What is the best approach to geo targeting?

Lately geo-targeting has been pretty popular in technology. By IP, cell tower, GPS, using browser plugins, HTML5?, mobile devices ...
Since I'm about to add some geo-targeted features on our site, I wanted to know what's the best approach. Is there some API that uses a mix of all those technologies? Or at least, what API/service would you recommend I use?
The service I'm working on doesn't need to be 100% accurate, so I'm OK with geo-IP, but if there's an easy way to do better, why not.
Technologies used are php, javascript, ajax, java.
Whatever you do please please please don't set the language of your website based on the user's IP, and then make it almost impossible to change unless you know said language and you feel like wasting hours (like ebay and paypal, among others, do). Use the browser's language.
Not everyone in, let's say, France speaks or wants to speak French.
I guess it's not very related to your question but i felt the need to rant about this, sorry :)
GEO IP is probably the best approach for now.
HTML5 looks promising, but it'll be a while before it's widely supported. And even then it requires explicit user approval, which kind of limits the possibilities for using it (for example auto-redirecting to a country specific version of a website)
For a start try the free http://api.hostip.info?ip=x.x.x.x (www.hostip.info for website)
It'll give you city and country in a xml structur. I've a small proxy-script writen in PHP on the http-server, which a html page calls with ajax and show the infomation in text and on a Google map using the Google geocoding api. Later on you can easy replace the api.hostip.info with an other api.
I would use IP address detection by default, and then optionally ask for a more specific location using the Javascript/HTML5 navigator.geolocation API when present. (For example, in iPhone Safari)
Most users are still using devices that don't know the location themselves, so plugins that are available will not get a better location than IP address detection does anyway. (Alternatively, they'll prompt users to manually enter data, which is annoying)
Max Mind is good. But if you are looking for a free solution, you may want to consider using the javascript geocoder. Eventually they will support addresses and country, but right now, they only give you a latitude and longitude.

Categories