Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Server 500 Error #17

Open
sebastianlew opened this issue Feb 15, 2016 · 60 comments
Open

Internal Server 500 Error #17

sebastianlew opened this issue Feb 15, 2016 · 60 comments

Comments

@sebastianlew
Copy link

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

@SzymonLisowiec
Copy link

Hello,
You give bad cookies for php-steam-tradeoffers.

2016-02-15 14:56 GMT+01:00 S3baso [email protected]:

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.steampowe red.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


Reply to this email directly or view it on GitHub
#17.

@sebastianlew
Copy link
Author

HMM, i am using https://github.com/SzymonLisowiec/php-steamlogin is it correct ?

@sebastianlew
Copy link
Author

Kurde.. Przeciez ty jestes polakiem. To jest moj kod ktory uzywam do logowania:
//This is my code waht i am using to log in

$SteamLogin = new SteamLogin(array(
'username' => 'S3baso',
'password' => 'XXX',
'datapath' => dirname('cache')

));
if($SteamLogin->success){
$logindata = $SteamLogin->login('', $authcode);

//echo $SteamLogin->view('http://steamcommunity.com/id/pandeu');
$sessionId = $logindata['sessionId'];
$cookies = $logindata['cookies'];

if($SteamLogin->error != '') echo $SteamLogin->error;

}else{
echo $SteamLogin->error;
}

print_r($cookies);
$steam = new SteamTrade();
$setup = $steam->setup(
$sessionId,
$cookies
);

@emdy
Copy link

emdy commented Feb 15, 2016

Hosting problem - change it
Use http://mipropia.com/ as free host you can test, because host need to bee safe mode off because client cant reach the url

@sebastianlew
Copy link
Author

Emm i think it isn't a problem. My host have safe mode off in php.ini

@emdy
Copy link

emdy commented Feb 17, 2016

Its host certificate problem!

@sebastianlew
Copy link
Author

Oh, okay, thank you mate for advice, i will try another host and i hope it'll help

@emdy
Copy link

emdy commented Feb 17, 2016

@S3baso as i told just test on http://mipropia.com/ or use localhost

@sebastianlew
Copy link
Author

mipropia.com throw me error 500, don't know why in php script. I'll just test it on localhost later.

@emdy
Copy link

emdy commented Feb 17, 2016

USE IT MY FRIENDZONE
require_once('classes/steam.class.php');
define('php-steamlogin', true);
require('main.php');

$SteamLogin = new SteamLogin(array(
'username' => '****',
'password' => '**
**',
'datapath' => dirname(FILE)
));

if($SteamLogin->success){

$authcode = '*****';
$blank='';
$logindata = $SteamLogin->login($blank,$authcode);
$login_values = array_values($logindata); //[1]=session, [2]=cookies
$steam = new SteamTrade();
$steam->setup($login_values[1],$login_values[2]);

$them = [ [
"appid" => 730,
"contextid" => "2",
"amount" => 1,
"assetid" => "4307137***"
]];

$result = $steam->makeOffer([
'partnerSteamId' => 76561198035589***,
'itemsFromMe' => [],
'itemsFromThem' => $them
]);
var_dump($result);

if($SteamLogin->error != '') echo $SteamLogin->error;
}else{
echo $SteamLogin->error;
}

@sebastianlew
Copy link
Author

Look, it's your code: http://sebaso.mipropia.com/test.php

If i try to put in there manualy api key, i'm getting server response while making offer 401 (Unauthorized)

@emdy
Copy link

emdy commented Feb 18, 2016

BECAUSE YOU NEED TO WHAIT 7 DAYS

@tallesdantas
Copy link

Same error , dont know whats wrong with my code , it loggs in , gets bot inventory, gets partner inventory but cant get own inventory , please emdy help =/

`$steam = new SteamTrade();

$steam->setup($session,$logindata['cookies']);

$INVENTORY = JSON_encode($steam->loadMyInventory([
'appId'=>$gameID
,'contextId'=>$igemContext
]));

//ECHO $INVENTORY;EXIT;

$PINVENTORY = JSON_encode(
$steam->loadPartnerInventory([
'partnerSteamId'=>'76561198048736485',
'appId'=>$gameID,
'contextId'=>$igemContext
]));

//echo $PINVENTORY;exit;

$tradeid = ([
    'partnerSteamId'=>'76561198061655090',
    'accessToken '=>'2gj7JSMf',
    'itemsFromMe'=>[],
    'itemsFromThem'=>[
        "appid" => $gameID,
        "contextid" => 2,
        "amount" => 1,
        "assetid" => "693235489",
    ],
    'message'=>'test trade '
]);

var_dump($steam->makeOffer($tradeid));
`

@sebastianlew
Copy link
Author

I solved this problem. I wrote new code in php curl. I will send you here this for a minute. I am on phone now

@tallesdantas
Copy link

S3baso , please provide us your haalp >_<

@sebastianlew
Copy link
Author

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 👎

@sebastianlew
Copy link
Author

Oh, you wanted load your own inventory..

$items = $steam ->loadMyInventory(array(
    'appId' => '730',
    'contextId' => '2',
    'language' => 'polish'
));

foreach($items as $data) {
var_dump($data);
}

For me works perfect. I hadn't problem with that

@tallesdantas
Copy link

Thanks S3baso , will try your code soon , really thanks =D you saved my day o/

@sebastianlew
Copy link
Author

No problem, i had same problem few days ago. So i really understand you :D

@tallesdantas
Copy link

S3baso , by the way , how do you confirm steam bot trade trought mobile auth? i know i will face this problem soon , i'm able to generate the Code to loging like the mobile one, but i dont know how to simmulate the confirmation can you help?

@sebastianlew
Copy link
Author

You need shared secret code (i exported that code from my app on phone). Search in google how to export shared secret code from your phone, then i will help you.

@tallesdantas
Copy link

I have it already o/ , can you add me on steam?

http://steamcommunity.com/profiles/76561198048736485/

@emdy
Copy link

emdy commented Feb 25, 2016

@S3baso what cind of link u use to manipulate with trade accept?

@sebastianlew
Copy link
Author

@emdy
Copy link

emdy commented Feb 25, 2016

@S3baso u use SDK or like root app to view values?

@sebastianlew
Copy link
Author

Only php, but this code took me weeks..

@emdy
Copy link

emdy commented Feb 25, 2016

I rooted my phone and am done yet ;)

@emdy
Copy link

emdy commented Feb 25, 2016

@S3baso author key is simple author code 5dig and t is trade Id,ye?

@sebastianlew
Copy link
Author

@emdy
Copy link

emdy commented Feb 29, 2016

@S3baso you tested to confirm trades, work?

@sebastianlew
Copy link
Author

I will put my script to github later.

@emdy
Copy link

emdy commented Feb 29, 2016

I get this urls from webcache but i have no idea what time you need to put, becase i get oops error so..

@timmy78
Copy link

timmy78 commented Feb 29, 2016

@S3baso Thank you for code example, it works fine !

So I don't understand why the function makeOffer doesn't work.
I have an error 411 ?!
If I add a "Content-Length" ($headers['Content-Length'] = 3495; at line 218), I have now a timeout : "Operation timed out after 5000 milliseconds with 0 bytes received".

Am I the only one ??

@sebastianlew
Copy link
Author

Are you sure that cookies are correct? Try to print response from curl and paste it here

@sebastianlew
Copy link
Author

Cookies must have SteamLogin, SteamMachineAuth, sessionid and something else but i don't remember. Can you paste variables from cookies what you have?

@timmy78
Copy link

timmy78 commented Feb 29, 2016

@S3baso You ask to me ?

@sebastianlew
Copy link
Author

Yes, you said that you have error 411 right?

@timmy78
Copy link

timmy78 commented Feb 29, 2016

@S3baso Yes, but my cookies and sessionId are correct because it works with your code .

@sebastianlew
Copy link
Author

So my code is working correct? You had error with halipso php tradeoffers yes?

@timmy78
Copy link

timmy78 commented Feb 29, 2016

@S3baso Yes your wode works fine, but the code of this library doesn't work for me 😉

@sebastianlew
Copy link
Author

Oh, okay. I think we all have problem with this library

@emdy
Copy link

emdy commented Feb 29, 2016

Its lib problem because http simple dom is missing some headers, use @Sbaso code - its same as php-tradeoffers!!!

@emdy
Copy link

emdy commented Feb 29, 2016

Root your phone or use SDK to get device id and other stuff.

@timmy78
Copy link

timmy78 commented Feb 29, 2016

Oh no, it was my fault, I had replaced all the URL https://steamcommunity.com by http://steamcommunity.com 😕 . I removed this change and it works fine now 😄

@amaraa019
Copy link

amaraa019 commented Jul 26, 2016

steam.class.php in replace all
timeout(5) to timeout(30) (Operation timed out after 5000 milliseconds with 0 bytes received)
it will disappear. if your steam.class.php use https increase timeout function's argument

@Govind13100
Copy link

@S3baso Hie there, I have tried your makeoffer() function , returning "null" :-(

I have passed all the parameter correctly>

Can you please suggest me any thing ?????

Any help would be very great!!!

@emdy
Copy link

emdy commented Jun 16, 2017

Start and check login status, itemid, tradeurl, mby itemid is inactive etc. more stuff that causes null

@Govind13100
Copy link

Govind13100 commented Jun 17, 2017

I checked all the parameters, I tried cookies by logging in manually into steam account and got the cookies and session id from browser settings. I also tired your login script to get all cookies and session id and then passed it to the makeoffer(). Still Null :-(

Yesterday when i run this makeoffer() its returns null on live server, and on localhost it returns

{"strError":"There was an error sending your trade offer. Please try again later.

You have logged in from a new device. In order to protect the items in your inventory, you will be unable to trade from this device for 7 days."}

From this error i understand the there is a parameter in inventory json called "market_tradeable_restrictons:7" this means i can trade my item after 7 days.

But now when i again hit the url on localhost, this time it returns null, I am so very confused about all this.

@emdy
Copy link

emdy commented Jun 17, 2017

If your not new in php i suggest export curl and test it, because Iam sure than you missing some attribute

@Govind13100
Copy link

Govind13100 commented Jun 20, 2017

$sessionId  = 'c65a62c35ff42f409b98dbf30d';
$cookies = 'steamCountry=US%7Cbdfba7df0d61cb192e69ad96beb42e635,steamLogin=76561197960912172%7C%7C84838E49336D76A77E2D351FBD6B7CB90D7DAE53, steamLoginSecure=7656119796ff0912172%7C%7C4EFE85A64073548BB93f925AE4052C9C2062BB323,steamMachineAuth76561197960912172=24300302D710425B41D4f7272975FAF204E977039, steamRememberLogin=76561197960912172%7C%7Cc0daf33cffb175964e11d20dd0a163849,sessionid=c65a62c3542f409b98dbf30d'; 
$partner = '424253243';
$token = 'Iqz42WHn';
$assetid = '10546157324';



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



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


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


    $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;

This is my code and i tried many combinations with sessionid and cookies

#Got the sessionid and cookies from your login script which you provided us

#Got the sessionid and cookies from browser setting

#By market_tradeable_restriction for 7days(because of new device login) , I have also tried this code on old device but still same negative result.

but i am still unable to get the positive result, it always returned null or sometimes a blank page,
I don't know what I am missing ???

I am asking you because i tried many thing and still got nothing.

If you could help me out here by looking at my code then it would be very greatful ..

Thanks in advance!!!!!!

@emdy
Copy link

emdy commented Jun 20, 2017

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

@emdy
Copy link

emdy commented Jun 20, 2017

You have one mistake, try to find it :D

@Govind13100
Copy link

Govind13100 commented Jun 21, 2017

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
Copy link

emdy commented Jun 21, 2017

Yes it will work!

@Govind13100
Copy link

Okay thanks buddy 😊

@Govind13100
Copy link

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
Copy link

emdy commented Aug 3, 2017

You need mobile authentication to provide process without cooldown.

@Govind13100
Copy link

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
Copy link

emdy commented Aug 3, 2017

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

@cptc0ld
Copy link

cptc0ld commented Jan 11, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants