行,我有一个简单的XML调用,它通过API检索数据,请参见下面的代码:按钮链接到简单的XML
$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'];
这一切完美的作品,并打破了网页,结果总数和当前页面。有了if else语句,我可以生成下一个和上一个按钮,但是如果我包含api的链接,当我点击它时,它只是调用页面并以xml格式显示结果。
当我想达到什么是哟提供一个按钮,简单地调用这些结果的第二页,即
$file = 'http://mywebsite.com/computers.xml?apikey=88888&cid=api&limit=5&page=2
但是只需点击此链接,显示的XML格式的网页,所以我需要什么要做的是点击一个按钮,并通过简单的XML函数检索信息,但我不知道这是可能的或如何去做。
所以任何意见将不胜感激。
感谢
您的意思是您希望让服务器发出请求,以便解析它并显示更漂亮的结果? http://stackoverflow.com/questions/2001897/get-the-value-of-an-url-response-with-curl – FlavorScape
这个问题很不清楚你究竟想要发生什么。请编辑问题文本并添加有关以下内容的信息:究竟应该发生什么,您当前的实现是什么,并且完全不按预期工作。通过讲几句话,期待他们猜测你想要发生的事情,你会浪费人们的时间。 – arkascha