I have a javascript that looks up some details on googlemaps for me, then returns them to a php script that does the web bit I actually need doing. I actually works by filling in a form and submitting it, so that php can handle the data.

However I now need to call the script combo from another script. With a normal straight php script I could use curl to effectively run the second script, however with the combo this approach won't run the javascript.

Any ideas how I can get round this anyone?

I have a javascript that looks up some details on googlemaps for me, then returns them to a php script

I don't understand why you don't just do this with Curl, then you could run the entire script from cron or from another php file or whatever you want.

The javascript gets details from googlemaps, then submits the to a php script whic formats them, and stores them in a mysql database as a cache.

The lookup needs to be triggered by data entered into a html form, and the final result is displayed on another page. The final result involves several lookups of different sorts, but this is the only one that I've not managed to do without using javascript.

OK, javascript is client side = must be parsed by the web browser.

So this means that the possibility of php parsing the javascript and running it is out of the realm of possibility, so you need a work around.

How about this, in your php script, if the google maps data is non existent, redirect to the page with the google maps javascript, then redirect back to the php script with the data either in the url or in a session variable.
:-/

I suppose I could have a "Processing" page that does the javascript and bounces back, suppose that could work.

Very nice, probably about as good as it is going to get.

Very nice, probably about as good as it is going to get.

Thanks

Very nice, probably about as good as it is going to get.

Looking at our logs, I notice that quite a few users, look at the page then go back, probably to change some details or similar, however back doesn't work because of the intermediary page. Any ideas how to avoid the intermediary page been the default "back" location?

You can create your own back button which utilizes the javascript window.history object but I'm pretty sure that there is no way to manipulate the behavior of the back button.

I already have a link back to the query form but people tend to use back on thoolbar, don't suppose you can blame them it's probably just habit.

But you gave me a good idea, if when I've done the javascript lookup etc. rather than jump to the refering page using window.location, I can use history.go that way if the user clicks back on the menu it all still works.

It seems to work.

But you gave me a good idea, if when I've done the javascript lookup etc. rather than jump to the refering page using window.location, I can use history.go that way if the user clicks back on the menu it all still works.

It seems to work.

That should work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.