halipso / php-steam-tradeoffers

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

Internal Server 500 Error #17

Open sebastianlew opened 8 years ago

sebastianlew commented 8 years ago

Array ( [0] => HTTP/1.1 500 Internal Server Error [Server] => Apache [Vary] => Accept-Encoding,Origin [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] => 89 [Content-Type] => application/json; charset=utf-8 [Date] => Mon, 15 Feb 2016 13:55:15 GMT [Connection] => close ) Error making offer! Server response code: 500

emdy commented 7 years ago

Git is full of answers stop been lazy and use google!!!!!!

emdy commented 7 years ago

You have one mistake, try to find it :D

Govind13100 commented 7 years ago

Can you just tell me this thing, if i manually logged in into steam account and get the cookies and sessionid from browser , does it will still work ????

emdy commented 7 years ago

Yes it will work!

Govind13100 commented 7 years ago

Okay thanks buddy 😊

Govind13100 commented 7 years ago

We are developing a steam website in which steam users can login and sell their skins to us. For merchant steam account(from which tradeoffer will be sent to steam users and their skins will come in this account) firstly we were using only email authentication for login process(script - https://github.com/SzymonLisowiec/php-steamlogin) in order to get the cookies and send tradeoffer to steam users using curl(makeoffer() present in above comment). But we have to sell this all steam users skins(which are in our merchant account) to another website name skin.cash so we enabled mobile authentication into our merchant account so skins would exchange immediately, by enabling this feature the trading process for users is a bit changed , now this script(https://github.com/SzymonLisowiec/php-steamlogin) always ask for two factor code. So we inputted once and saved those cookies and session id into database and used them to send tradeoffer to steam users.But at some point or after some days those cookies are getting expire.

Do all other steam bot present in market only use email authentication for merchant account ???

Or is there any other solution or script for this???

Any help will be appreciated.

emdy commented 7 years ago

You need mobile authentication to provide process without cooldown.

Govind13100 commented 7 years ago

Yes i am using mobile authentication account , but when first login using script , i get cookies and session id and i stored it into my database and use them to send tradeoffer. But after 2 days they are getting expired. So is this login script do have any other function or any other thing through which i can prevent login after two days manually ???

emdy commented 7 years ago

Its steam, more you trade more or login, you get up to one week cookie access, i loged in once a week.

cptc0ld commented 4 years ago

Oh sorry here is my function (not optimized) i wrote that in 15 minutes this code is ugly but works:

function makeOffer($sessionId, $cookies, $partner, $message = '', $token, $assetid) {
$type = 'POST';
$url = 'https://steamcommunity.com/tradeoffer/new/send';

$steamid = bcadd($partner, '76561197960265728');

    $data= array (
            'sessionid' => $sessionId,
            'serverid' => '1',
            'partner' => $steamid,
            'tradeoffermessage' => $message,
        'trade_offer_create_params' => '{"trade_offer_access_token": "'.$token.'"}',
            'json_tradeoffer' => '{"newversion":true,"version":2,"them":{"assets":[],"currency":[],"ready":false},"me":{"assets":[{"appid":730,"contextid":"2","amount":1,"assetid":"'.$assetid.'"}],"currency":[],"ready":false}}'
        );

        $c = curl_init();
        curl_setopt($c, CURLOPT_HEADER, false);
        curl_setopt($c, CURLOPT_NOBODY, false);
        curl_setopt($c, CURLOPT_URL, $url);
        curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($c, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)");
        curl_setopt($c, CURLOPT_COOKIE, $cookies);
        curl_setopt($c, CURLOPT_POST, 1);
        curl_setopt($c, CURLOPT_POSTFIELDS, http_build_query($data));
        curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($c, CURLOPT_HTTPHEADER, array('Referer: https://steamcommunity.com/tradeoffer/new/?partner='.$partner.'&token='.$token));
        curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($c, CURLOPT_CUSTOMREQUEST, strtoupper($type));
        $return = curl_exec($c);
        curl_close($c);

return $return;
}

Use:

echo makeOffer($sessionId, $cookies, $partner, $message = '', $token, $assetid);

$sessionId = session ID of actually logged in user $cookies = cookies of actually logged in user $partner = partner from trade link (for example trade link: https://steamcommunity.com/tradeoffer/new/?partner=191983333&token=K13zBHQ5 --- partner for that is 191983333) $message = message for your offer (not required) $token = is token from trade link (for example: https://steamcommunity.com/tradeoffer/new/?partner=191983333&token=K13zBHQ5 -- token is K13zBHQ5) $assetid = asset ID of item you want to send offer

P.S. Sorry for my bad english 👎

I have been having problem in cookies can you show me what string is stored in $cookies variable or what all entries are there in it