0

I am getting xml from https://automap.precisionplanting.com/v1/farms/ and now i want to convert it into php array. I have tried many code but no success. Following some of code examples i have implemented.

$url = "https://automap.precisionplanting.com/v1/farms/";
$xml = file_get_contents($url);

$feed = simplexml_load_string($xml);
print_r($feed);

I want to get output in php array and i have tried different ways for it. above i have shown one example.

What can be error in this? how can i solve this?

Jass
  • 63
  • 1
  • 1
  • 5

1 Answers1

0

Look at this How to convert xml into array in php?

$xml = simplexml_load_string($xmlstring);
$json = json_encode($xml);
$array = json_decode($json,TRUE);
Community
  • 1
  • 1
Michał Fraś
  • 407
  • 7
  • 12
  • It is giving Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in E:\xampp\htdocs\demo.php on line 9 – Jass Aug 05 '14 at 08:33
  • could you post beginning of file you are giving to simplexml_load_string (fevw lines)? When i'm going on this page I've get log in page – Michał Fraś Aug 05 '14 at 08:35
  • try to open https://automap.precisionplanting.com/v1/farms/ and from this URL you will get XML data – Jass Aug 05 '14 at 08:45