XML : XML Parsing with Symfony

I have a XML file in a url. I want to parse data from the xml and to hydrate my entity.

I've code that (crawler) but this does not work (empty response).

  public function getUsersAction(Request $request)  {      $crawler = new Crawler();      $crawler->addXmlContent(          file_get_contents(              'http://localhost/myproject/web/feed-users.xml'          )      );        json_encode($crawler);        return new JsonResponse(          array(              'crawler' => $crawler          )      );  }    

Thanks

No comments:

Post a Comment