Viglink Catalog API


/ Published in: PHP
Save to your folder(s)

Example


Copy this code and paste it in your HTML
  1. <?php
  2. DEFINE (VIGLINK_API_KEY,'YOUR_API_KEY',true); // YOUR_API_KEY isi dg viglink API punya agan
  3. function parsing_xml($url){
  4. $xml = simplexml_load_file($url);
  5. $data = json_decode(json_encode($xml),true);
  6. return $data;
  7. }
  8. function viglink_get_products($query){
  9. $url = 'http://catalog.viglink.com/vigcatalog/products.xml?key=' . VIGLINK_API_KEY . '&keyword=' . urlencode($query);
  10. $data = parsing_xml($url);
  11. return $data;
  12. }
  13.  
  14. $data = viglink_get_products('dewalt');
  15. echo '<pre>';
  16. print_r($data);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.