0
我試着用simple_xml_file()和file_get_contents(); 但它不工作。php如何從Google URL獲取xml內容
我輸入網址:http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=php
我試着用simple_xml_file()和file_get_contents(); 但它不工作。php如何從Google URL獲取xml內容
我輸入網址:http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=php
當然你不只是尋找的SimpleXMLElement。
$xml = new SimpleXMLElement(file_get_contents('http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=php'));
var_dump($xml);
對名稱沒有使用rawurlencode。
$url = http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=' . rawurlencode('php tutorial');
謝謝你!但如何獲得URL空間查詢。 我試過了: $ url = urlencode('....&q = php tutorial'); 但它不工作 –
您能否包含顯示您已經嘗試過的代碼的代碼段?你想要將xml作爲字符串加載還是作爲可查詢的xml結構? – kdbanman
任何我可以從中獲取數據的方式。請! –