Want to crawl the remaining stock quantity on this site
Http://www.beibei.com/detail/105272.html
Use fopen (), and then read the source code, display the inventory amount of 0, checked the data said need to disguise HTTP, do not know how to do, online, such as Daniel ~ ~ ~
Reply to discussion (solution)
File_get_contents (); Obtain the source code and then use regular filtering.
Moderator, the amount of inventory in this method to grab is-empty
has been solved:
$HXCSRF, ' id ' = $id )); $opts = Array (' http ' = = Array ( ' method ' = ') ' POST ', ' header ' = ' content-type:application/x-www-form-urlencoded ', ' Content ' = > $postdata )); $context = Stream_context_create ($opts); $sku = File_get_contents ($skuapi, False, $ context); $result = Json_decode ($sku, true); Echo '
; Echo '';p rint_r ($result); Echo '
';? >
Array
(
[Success] = 1
[Data] = Array
(
[Sku_id_map] = = Array
(
[3] = = Array
(
[0] = 15
[1] = 16
[2] = 19
[3] = 20
[4] = 22
[5] = 458
[6] = 459
[7] = 468
)
)
[Sku_kv_map] = = Array
(
[K3] = Color
[V15] = large B Red
[V16] = large B Black
[V19] = large B Green
[V20] = large B Powder
[V22] = s Green
[v458] = s Black
[v459] = small Pink
[v468] = s RED
)
[Sku_stock_map] = = Array
(
[V15] = = Array
(
[id] = 61788
[Stock] = 100
[Price] = 9900
[Origin_price] = 21800
)
[V16] = = Array
(
[id] = 61789
[Stock] = 100
[Price] = 9900
[Origin_price] = 21800
)
[v19] = = Array
(
[id] = 61790
[Stock] = 100
[Price] = 9900
[Origin_price] = 21800
)
[V20] = = Array
(
[id] = 61791
[Stock] = 100
[Price] = 9900
[Origin_price] = 21800
)
[V22] = = Array
(
[id] = 61792
[Stock] = 100
[Price] = 8900
[Origin_price] = 19800
)
[v458] = = Array
(
[id] = 61793
[Stock] = 100
[Price] = 8900
[Origin_price] = 19800
)
[v459] = = Array
(
[id] = 61794
[Stock] = 100
[Price] = 8900
[Origin_price] = 19800
)
[v468] = = Array
(
[id] = 61795
[Stock] = 100
[Price] = 8900
[Origin_price] = 19800
)
[V0] = 800
)
)
)