FrecKDancE
Новичок
- Сообщения
- 19
- Репутация
- 1
Приветствую! Столкнулся с такой проблемой, что считываются не все данные из строки и соответственно при выводе в MsgBox'e всё сбивается.
Вот как выводит:
Соответственно не выводит "position", "price", "live_time", "left"
{"success":true,"items":[{"item_id":"1148743788","assetid":"0","classid":"520026202","instanceid":"188530139","real_instance":"188530139","market_hash_name":"MP7 | Urban Hazard (Field-Tested)","position":87,"price":9.99,"currency":"RUB","status":"1","live_time":3616,"left":null,"botid":"0"},
{"item_id":"1148742843","assetid":"20719873846","classid":"1309991125","instanceid":"188530139","real_instance":"188530139","market_hash_name":"Glock-18 | Wraiths (Field-Tested)","position":2,"price":10.99,"currency":"RUB","status":"1","live_time":3633,"left":null,"botid":"0"},
Код:
$http1 = "https://market.csgo.com/api/v2/items?key="
$fullrequest = $http1&$apikey
$http2 = BinaryToString(InetRead($fullrequest,4))
$aItems = StringRegExp($http2, '(?s)(?:item_id|assetid|classid|instanceid|real_instance|market_hash_name|position|price|currency|status|live_time|left|botid)":"([^"]+)', 3)
$iItems = UBound($aItems)
For $i = 0 To $iItems - 1 Step 3
$item_id = $aItems[$i]
$assetid = (($i + 1 < $iItems) ? $aItems[$i + 1] : '')
$classid = (($i + 2 < $iItems) ? $aItems[$i + 2] : '')
$instanceid = (($i + 3 < $iItems) ? $aItems[$i + 3] : '')
$real_instance = (($i + 4 < $iItems) ? $aItems[$i + 4] : '')
$hash_name = (($i + 5 < $iItems) ? $aItems[$i + 5] : '')
$position = (($i + 6 < $iItems) ? $aItems[$i + 6] : '')
$price = (($i + 7 < $iItems) ? $aItems[$i + 7] : '')
$currency = (($i + 8 < $iItems) ? $aItems[$i + 8] : '')
$status = (($i + 9 < $iItems) ? $aItems[$i + 9] : '')
$live_time = (($i + 10 < $iItems) ? $aItems[$i + 10] : '')
$left = (($i + 11 < $iItems) ? $aItems[$i + 11] : '')
$botid = (($i + 12 < $iItems) ? $aItems[$i + 12] : '')
switch MsgBox(1+4096, @ScriptName,"item_id: "&$item_id&@CRLF&"assetid: "&$assetid&@CRLF&"classid: "&$classid&@CRLF&"instanceid: "&$instanceid&@CRLF&"real_instance: "&$real_instance&@CRLF&"hash_name: "&$hash_name&@CRLF&"position: "&$position&@CRLF&"price: "&$price&@CRLF&"currency: "&$currency&@CRLF&"status: "&$status&@CRLF&"live_time: "&$live_time&@CRLF&"left: "&$left&@CRLF&"botid: "&$botid)
case 2
ExitLoop
EndSwitch
next
Соответственно не выводит "position", "price", "live_time", "left"