I am trying to get xml data with the sima-land API, but it returns a blank page!

<?php $curl = curl_init('https://www.sima-land.ru/api/v2/category'); curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/xml')); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $xml = curl_exec($curl); // сохранен xml curl_close($curl); $items = simplexml_load_string($xml); print_r($items); 
  • You have an Ошибка загрузки XML . - Visman
  • Again, why does it occur? - Linker
  • So the server does not give you data, it seems to me. - Visman
  • I have a similar code. but gives error 403 forbidden. What could be the problem? - Alexander

1 answer 1

Add installation options

 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 

to disable SSL certificate checking.

  • It helped! thanks - Linker