Advertisement
LrdArc

Tokopedia | intip.in/tokoedo

Nov 10th, 2016
984
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.31 KB | None | 0 0
  1. <?php
  2. /*
  3. // Ngambil link produk & toko dkk
  4. https://ta.tokopedia.com/promo/v1/display/products?dep_id=8&src=directory&item=200&page=1
  5.  
  6. // Views
  7. https://www.tokopedia.com/provi/check?pid=5335793
  8.  
  9. // Item sold
  10. https://js.tokopedia.com/productstats/check?pid=5335793
  11.  
  12. // Product review
  13. https://www.tokopedia.com/ajax/product-review-list.pl?p_id=5335793&action=review_list
  14.  
  15. // Reputation
  16. https://inbox.tokopedia.com/reputation/v1/shop/220795
  17.  
  18. */
  19.  
  20. // Inisiasi CURL
  21. include( 'csc_curl.php' );
  22. $c = new curl;
  23.  
  24. // Set Category ID
  25. $cat_id = 8;
  26. $page = 1;
  27. $item = 10; // tar ganti ke 200
  28. $url = 'https://ta.tokopedia.com/promo/v1/display/products?dep_id=' . $cat_id . '&src=directory&item=' . $item . '&page=' . $page;
  29.  
  30. // Download JSON API
  31. $json = file_get_contents( $url );
  32.  
  33. // Convert ke Array
  34. $json = json_decode( $json );
  35.  
  36. // Looping masing2 item
  37. foreach( $json->data as $data ) {
  38.     // Set variable untuk masing2 produk
  39.     $prod_id = $data->product->id;
  40.     $prod_name = $data->product->name;
  41.     $prod_link = $data->product->uri;
  42. //  echo "$prod_id $prod_name $prod_link <br>";
  43.  
  44.     // Set variable untuk masing2 toko
  45.     $toko_id = $data->shop->id;
  46.     $toko_name = $data->shop->name;
  47.  
  48.     // Ngambil views
  49.     $c->bc = $c->get( 'https://www.tokopedia.com/provi/check?pid=' . $prod_id );
  50.     $views = $c->xp( '"view":', '}' );
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement