Tutorial :Auto redirect to URL returned in XML?



Question:

Is there a way to automatically go to a URL returned via XML from an API call? For instance I call and it returns the XML file that I parse with simple_xml_load() and then I create a link like so,

<a target=_blank href='" . $title->links->homedetails . "?scrnnm=Nexus-Software'>".  $title->address->street . "</a>  

But I do not want the user to have to click, is there a way to have the page automatically go to that returned link after submitting the form?


Solution:1

If I understood your question correctly this would do the trick:

<?php header('Location: '.$title->links->homedetails.'?scrnnm=Nexus-Software'); ?>  

It redirects the user to the location specified. You just have to watch out to call it before any output is sent to the browser.

You can find some more info at: http://pl2.php.net/manual/pl/function.header.php


Solution:2

You could also try displaying a confirmation page to the user and using or a JavaScript onLoad event to send the user immediately to the new URL.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »