Open sebastianlew opened 8 years ago
Hello, You give bad cookies for php-steam-tradeoffers.
2016-02-15 14:56 GMT+01:00 S3baso notifications@github.com:
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 https://github.com/halipso/php-steam-tradeoffers/issues/17.
HMM, i am using https://github.com/SzymonLisowiec/php-steamlogin is it correct ?
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 );
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
Emm i think it isn't a problem. My host have safe mode off in php.ini
Its host certificate problem!
Oh, okay, thank you mate for advice, i will try another host and i hope it'll help
@S3baso as i told just test on http://mipropia.com/ or use localhost
mipropia.com throw me error 500, don't know why in php script. I'll just test it on localhost later.
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; }
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)
BECAUSE YOU NEED TO WHAIT 7 DAYS
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));
`
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
S3baso , please provide us your haalp >_<
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 :-1:
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
Thanks S3baso , will try your code soon , really thanks =D you saved my day o/
No problem, i had same problem few days ago. So i really understand you :D
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?
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.
I have it already o/ , can you add me on steam?
@S3baso what cind of link u use to manipulate with trade accept?
@S3baso u use SDK or like root app to view values?
Only php, but this code took me weeks..
I rooted my phone and am done yet ;)
@S3baso author key is simple author code 5dig and t is trade Id,ye?
not really, you must get from that confirmation key, and confirmation id. Then use
@S3baso you tested to confirm trades, work?
I will put my script to github later.
I get this urls from webcache but i have no idea what time you need to put, becase i get oops error so..
@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 ??
Are you sure that cookies are correct? Try to print response from curl and paste it here
Cookies must have SteamLogin, SteamMachineAuth, sessionid and something else but i don't remember. Can you paste variables from cookies what you have?
@S3baso You ask to me ?
Yes, you said that you have error 411 right?
@S3baso Yes, but my cookies and sessionId are correct because it works with your code .
So my code is working correct? You had error with halipso php tradeoffers yes?
@S3baso Yes your wode works fine, but the code of this library doesn't work for me :wink:
Oh, okay. I think we all have problem with this library
Its lib problem because http simple dom is missing some headers, use @Sbaso code - its same as php-tradeoffers!!!
Root your phone or use SDK to get device id and other stuff.
Oh no, it was my fault, I had replaced all the URL https://steamcommunity.com
by http://steamcommunity.com
:confused: . I removed this change and it works fine now :smile:
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
@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!!!
Start and check login status, itemid, tradeurl, mby itemid is inactive etc. more stuff that causes null
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.
If your not new in php i suggest export curl and test it, because Iam sure than you missing some attribute
$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
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!!!!!!
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