OK, I have a simple xml call which retrieves data via an api, please see code below:
$file = 'http://mywebsite.com/computers.xml?apikey=88888&cid=api&limit=5&page=1 ' ;
if(!$xml = simplexml_load_file($file))
exit('Failed to open '.$file);
$total_pages = $xml->results->attributes()->totalPages;
$current_page = $xml->results->attributes()->currentPage;
$total_results = $xml->results->attributes()->totalResults;
foreach($xml->computer as $computer){
echo $computer['name'];
this all works perfect and breaks down the total number of pages, results and current page. With an if else statement i can generate next and previous buttons, however if i include the link to the api, when i click on it it simply calls the page and show the results as an xml format.
When what i want to achieve is yo provide a button which simply calls the second page of these results, i.e
$file = 'http://mywebsite.com/computers.xml?apikey=88888&cid=api&limit=5&page=2
however just clicking on this link shows the page in xml format, so what i need to do is to click on a button and retrieve the info via the simple xml function, however i do not know if this is possible or how to go about it.
And so any advice would be appreciated.
Thanks