I have an api key. And have tested the urls I'm trying to pull data from and they both work. When I try with SimpleXML and just using var_dump I get object(SimpleXMLElement)#1 (0) { so I went ahead and tried pulling the data as JSON and using json_decode and a var_dump and that returns NULL everytime. Please help!
I submitted sample code for JSON that works and sample code for XML that works. Try either of them. That will get you started. Once your XML or JSON jobjects are retrieved and stored in an associated arrary (my sample does that), then the final trick is how you subscript various elements. Some of them are subarrays that need to be iterated, some can be addressed directly. The XML attributes are not array entries and get subscripted with hard brackets. There are examples of each of these types in the sample code. Start from there, with one browsesr window showing you the output of the sample code. Take the hard URL and paste it into a second browser window so you can look at the raw XML output. Compare the two and you'll have a Rosetta stone, between the arrays and attributes passed back and how to retrieve various elements.
I have an api key. And have tested the urls I'm trying to pull data from and they both work. When I try with SimpleXML and just using var_dump I get object(SimpleXMLElement)#1 (0) { so I went ahead and tried pulling the data as JSON and using json_decode and a var_dump and that returns NULL everytime. Please help!
Message edited by OBX 3 years ago
xero976 – 3 years ago
Did you ever find an answer for this question? I am using SAX parser for my calls.
Chris
Walt Brubaker – 3 years ago
I submitted sample code for JSON that works and sample code for XML that works. Try either of them. That will get you started. Once your XML or JSON jobjects are retrieved and stored in an associated arrary (my sample does that), then the final trick is how you subscript various elements. Some of them are subarrays that need to be iterated, some can be addressed directly. The XML attributes are not array entries and get subscripted with hard brackets. There are examples of each of these types in the sample code. Start from there, with one browsesr window showing you the output of the sample code. Take the hard URL and paste it into a second browser window so you can look at the raw XML output. Compare the two and you'll have a Rosetta stone, between the arrays and attributes passed back and how to retrieve various elements.