Hi Ross, No, not a maps issue, and aside from using fopen() to access the page containing the javascript, which originally was with the intent of using document.write(), I tested that page first just on it's own - this is where the document.write() failed to produce anything to screen, as well as writeln() and println() - so at that stage php didn't come in to play, and hence the reason I was confused.
But yes, clearly after establishing the fact that fopen() was not going to invoke the javascript within the php function environment, made sense that not only the write() function would be of use, but also the cookie setting. I guess I was just half hoping there would be php equivellent code to re-produce the maps api which fetches the distance. AJAX however does sound like what is going to have to be used here... Though even that will have to be invoked in a javascript function (from what I understand) - and I'm quite stuck in using the current search function in PHP... Please consider this thread closed, I'll try to play with the php version of http_get().. Cheers Ross, Jess. On Thu, Jun 18, 2009 at 3:08 AM, Rossko <[email protected]> wrote: > > > So, what I tried to do first is to put the script to a separate page, > > then tried to use a "document.write(result);", so the PHP function can > > use the fopen(), read the page contents and trim if necessary, but for > > some reason, document.write() just doesn't want to spit that out to > > the page.. I've also tried println() and writeln() - doing it with a > > normal string is ok.. > > Well, no it wouldn't work. Try to grasp that php runs at the > server ; the server opens mypage.php or whatever, runs any bits of > php, outputs any bits of html to the client, runs the next bit of php > if any that it finds, and so on. Finally the server comes to the end, > and php execution is finished. Then, all the text that has been > output gets sent to the client's browser for interpretation. The > browser displays any html it finds, runs any javascript it finds, etc > etc. And that's it. There is no way that php can ever read back part > of page that's been modified in the browser - it's in a completely > different environment, and in any case php execution is finished > before the client does anything at all. > > You can of course write javascript that sends results to some php > script ; that php script can then 'do things' with the results without > sending any new html page to the client, but it could send data in the > form of text, XML, JSON, blah. You can write javascript that listens > for data results sent back from that php script, and the carry out > some more actions at the client end - update the screen, do yet more > sums, wait for the user to press a button, whatever. That's the basis > of AJAX which sounds like it will do what you want. > > Not a maps issue. > > cheers, Ross K > > > > -- __________________________________ Logisoft Technologies w www.logisofttech.com e [email protected] p +61 2 8003 4537 m +61 4 0656 8714 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
