Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. <?php
  2.  
  3. $xml = '<digiseller.request><category><id>99534</id></category><seller><id>748883</id></seller><pages><num></num><rows></rows></pages><products><order></order><currency></currency></products><lang>ru-RU</lang></digiseller.request>';
  4. $url = 'http://shop.digiseller.ru/xml/shop_products.asp';
  5. $curl = curl_init($url);
  6. curl_setopt ($curl, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
  7. curl_setopt($curl, CURLOPT_POST, true);
  8. curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
  9. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  10. $result = curl_exec($curl);
  11. curl_close($curl);
  12. $array_data = json_decode(json_encode(simplexml_load_string($result)), true);
  13. $item_counter = 0;
  14. print_r ($array_data);
  15. while ($array_data['products']['product'][$item_counter]['id'] != '') {
  16.    
  17.     print_r ($array_data['products']['product'][$item_counter]['name']);
  18.     $item_counter = $item_counter + 1;
  19. }
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement