halipso / php-steam-tradeoffers

Steam Trade Offers for PHP (based on node.js library by Alex7Kom)
76 stars 31 forks source link

Error loading inventory. Code:400 #18

Open xenkocz opened 8 years ago

xenkocz commented 8 years ago

Hello. When i want get partner invertory this error shows up...

Error loading inventory. Code:400

and if i put generate url into search...

url: https://steamcommunity.com/tradeoffer/new/partnerinventory/?sessionid=2c7######768&partner=7.6561####6641E+16&appid=730&contextid=2 json response: {"success":false,"error":"missing required parameter"}

Here is $response:

Response {#130 ▼ +code: 400 +raw_body: "{"success":false,"error":"missing required parameter"}" +body: {#656 ▼ +"success": false +"error": "missing required parameter" } +headers: array:10 [▼ 0 => "HTTP/1.1 400 Bad Request" "Server" => "Apache" "X-Frame-Options" => "DENY" "Content-Security-Policy" => "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://steamcommunity-a.akamaihd.net/ https://api.steampowered.com/ http://www.google-analytics.com https://ssl.google-analytics.com https://www.google.com https://www.gstatic.com https://apis.google.com; object-src 'none'; connect-src 'self' http://steamcommunity.com https://steamcommunity.com https://api.steampowered.com/; frame-src 'self' http://store.steampowered.com/ https://store.steampowered.com/ http://www.youtube.com https://www.youtube.com https://www.google.com;" "Expires" => "Mon, 26 Jul 1997 05:00:00 GMT" "Cache-Control" => "no-cache" "Content-Length" => "54" "Content-Type" => "application/json; charset=utf-8" "Date" => "Thu, 18 Feb 2016 06:18:46 GMT" "Connection" => "keep-alive" ] } pict of error https://gyazo.com/16d9f4f1cb1ebe663e20d16d6f5aa6f1

Thx for your TIME!

emdy commented 8 years ago

Error is one but we need to view your code.

emdy commented 8 years ago

Trade offer is cheeky stuff but another steam stuff is ez

xenkocz commented 8 years ago
        $inv = $steam->loadPartnerInventory(['partnerSteamId' => 76561#######301, 'appId' => 730, 'contextId' => 2]);
        dd($inv);

using laravel "dd" is something like echo

yeah... and i change in steam.class.php this:

return $this->_loadInventory(array(), $uri, array(
            'json' => TRUE,
            'headers' => array(
              'referer' => 'https://steamcommunity.com/tradeoffer/'.$offer.'/?partner='.$this->toAccountID($options['partnerSteamId'])
            ) , $options['contextId'], null));  

to

        return $this->_loadInventory(
            array(), 
            $uri, 
            array(
                'json' => TRUE,
                'contextId' => $options['contextId'],
                'headers' => array('referer' => 'https://steamcommunity.com/tradeoffer/'.$offer.'/?partner='.$this->toAccountID($options['partnerSteamId'])), 
            ), 
            $options['contextId']
        );