s.a arkadaşlar. php kullanarak veri çekmeye çalışıyorum. site API desteği veriyor.
şimdi... bir sitenin atom ve json olarak 2 türlü kaynağı var:
site.com/search.atom?q=merhaba
site.com/search.json?q=merhaba
---
kaynağı ATOM gösterip (site.com/search.atom?q=merhaba) SimpleXMLElement ile veri çekebiliyorum.
$atom_search = new SimpleXMLElement($word);
BUNDA SORUN YOK.
---
ama kaynağı JSON gösterip (site.com/search.json?q=merhaba) SimpleXMLElement ile veri çekeMİYORUM.
belliki JSON kullanırken SimpleXMLElement yerine farklı birşey kullanacağız ama ne? bunu bir türlü bulamadım. yardımlarınızı bekliyorum. çok teşekkürler.
GÜNCELLEME:
kaynağı JSON gösterip ve SimpleXMLElement kullandığımda aldığım hata:
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in C:\AppServ\www\pro\search.php:143 Stack trace: #0 C:\AppServ\www\pro\search.php(143): SimpleXMLElement->__construct('{"completed_in"...') #1 {main} thrown in C:\AppServ\www\pro\search.php on line 143
şimdi... bir sitenin atom ve json olarak 2 türlü kaynağı var:
site.com/search.atom?q=merhaba
site.com/search.json?q=merhaba
---
kaynağı ATOM gösterip (site.com/search.atom?q=merhaba) SimpleXMLElement ile veri çekebiliyorum.
$atom_search = new SimpleXMLElement($word);
BUNDA SORUN YOK.
---
ama kaynağı JSON gösterip (site.com/search.json?q=merhaba) SimpleXMLElement ile veri çekeMİYORUM.
belliki JSON kullanırken SimpleXMLElement yerine farklı birşey kullanacağız ama ne? bunu bir türlü bulamadım. yardımlarınızı bekliyorum. çok teşekkürler.
GÜNCELLEME:
PHP:
$search = "http://site.com/search.json?q=".$q."";
$atom_search = new SimpleXMLElement($hede);
kaynağı JSON gösterip ve SimpleXMLElement kullandığımda aldığım hata:
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in C:\AppServ\www\pro\search.php:143 Stack trace: #0 C:\AppServ\www\pro\search.php(143): SimpleXMLElement->__construct('{"completed_in"...') #1 {main} thrown in C:\AppServ\www\pro\search.php on line 143