PHP to Google API and Back

Never done it before...

Page 1 of 1

0 Replies - 795 Views - Last Post: 15 December 2009 - 08:55 AM Rate Topic: -----

#1 nullsys   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 64
  • Joined: 29-January 09

PHP to Google API and Back

Posted 15 December 2009 - 08:55 AM

Ello,
Im fairly new to working with Ajax and PHP, so I was hoping someone could help me with this predicament...

I have some data stored in SQL, which is manipulated every 30 minutes by "file.php".
Part of the manipulation now requires something I havn't done before, so this is where im stuck...

I need the data to be sent to a Google Maps API, which performs its own calculation and returns true/false.
The "file.php" must then interperate this new data and perform any adjustments.

I've never done this kind of round-trip before.
PHP > Javascript > Google API > Javascript > PHP

Essentially, the Google API will return true or false through javascript. I then need to get that data and send it back to the "file.php".
I know that you can setup a page, with a button and retrieve data from php/sql, perform calculations on it and then send it back all through Ajax, but I've never done it without user interaction. I also don't know if its secure at all.

To clarify the situation, I found an example:
http://www.ajaxf1.co...php.html?page=3
// Change the value of the outputText field
function setOutput(){
if(httpObject.readyState == 4){
document.getElementById('outputText').value = httpObject.responseText;

}
}

 

// Implement business logic
function doWork(){
httpObject = getHTTPObject();
if (httpObject != null) {
httpObject.open("GET", "upperCase.php?inputText="
+document.getElementById('inputText').value, true);
httpObject.send(null);
httpObject.onreadystatechange = setOutput;
}
}

I beleive this accomplishes part of what im looking for, but is it really secure, can I ensure that "uppserCase.php" is accepting input from the Ajax code and not a malicious user?

Could anyone please give me some pointers on this?
I don't have any code to show because of course, I don't know where to start, sorry.
Im not looking for code or someone to do this for me, Im just looking for tips, pointers etc.
Any help would be most welcomed.

This post has been edited by nullsys: 15 December 2009 - 09:39 AM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1