Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- // Ngambil link produk & toko dkk
- https://ta.tokopedia.com/promo/v1/display/products?dep_id=8&src=directory&item=200&page=1
- // Views
- https://www.tokopedia.com/provi/check?pid=5335793
- // Item sold
- https://js.tokopedia.com/productstats/check?pid=5335793
- // Product review
- https://www.tokopedia.com/ajax/product-review-list.pl?p_id=5335793&action=review_list
- // Reputation
- https://inbox.tokopedia.com/reputation/v1/shop/220795
- */
- // Inisiasi CURL
- include( 'csc_curl.php' );
- $c = new curl;
- // Set Category ID
- $cat_id = 8;
- $page = 1;
- $item = 10; // tar ganti ke 200
- $url = 'https://ta.tokopedia.com/promo/v1/display/products?dep_id=' . $cat_id . '&src=directory&item=' . $item . '&page=' . $page;
- // Download JSON API
- $json = file_get_contents( $url );
- // Convert ke Array
- $json = json_decode( $json );
- // Looping masing2 item
- foreach( $json->data as $data ) {
- // Set variable untuk masing2 produk
- $prod_id = $data->product->id;
- $prod_name = $data->product->name;
- $prod_link = $data->product->uri;
- // echo "$prod_id $prod_name $prod_link <br>";
- // Set variable untuk masing2 toko
- $toko_id = $data->shop->id;
- $toko_name = $data->shop->name;
- // Ngambil views
- $c->bc = $c->get( 'https://www.tokopedia.com/provi/check?pid=' . $prod_id );
- $views = $c->xp( '"view":', '}' );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement