Open Govind13100 opened 7 years ago
Yes you can. You need user full trade url with token. Token is the key for public tradeing.
But i have used makeoffer() which automatically access the trade url which includes token and partnerid .
You cant get token automateclly from lib, thats why user provides trade link, because of token.
If you know little bit of php than i can send my, other type of php simple code, because this lib do many of unwanted stuff.
But I did not provided any trade link in makeoffer() , still works fine. The trade offer was sent successfully. Let me tell you my whole scenario. I am using one steam id in script which I my merchant id. I will take users items into my merchant id so I am sending trade offer to user from my merchant id and the items are from users inventory.In between I am not inputed any trade URL of users the makeoffer() function automatically sends the trade offer . I hope this is correct ???
Ya you're right makeoffer() can't fetch trade URL of users. But I am confused that how this script will send trade if they are not friend ??? Any suggestion or example would be very appreciable. Thank you
I just dont like this lib because of many curl proccess func. Invite me http://steamcommunity.com/id/emdytime/
Sorry I haven't saw your another reply of invitation because I am on mobile. Ya I will send you the friend request in morning when I am able to access through desktop. Thank you for your support
This issues is sloved , now i can trade without having friends ! :-)
But how to send more than i item ??? can you suggest me ??
Just add multiple arrays in json string in object me or them.
Example: $skins = {"appid":730,"contextid":"2","amount":1,"assetid":"ASSETID"},{"appid":730,"contextid":"2","amount":1,"assetid":"ASSETID"},...... etc. {"assets":[$skins],"currency":[],...
Thanks a lot :-)
Explain me please, how to trade without having friends? Thanks!
@e1sep0 here you can send trade offer without having friends using curl
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
@Govind13100 , i use same params, but make request with GuzzleHttp
$ability = "webTradeEligibility=" . urlencode('{"allowed":1,"allowed_at_time":0,"steamguard_required_days":15,"sales_this_year":0,"max_sales_per_year":200,"forms_requested":0,"new_device_cooldown_days":7}') . ';';
$tradeOffer = [
'newversion' => true,
'version' => 2,
'me' => ['assets' => $itemsFromMe, 'currency' => [], 'ready' => false],
'them' => ['assets' => $itemsFromThem, 'currency' => [], 'ready' => false],
];
$formFields = [
'serverid' => 1,
'sessionid' => $sessionID,
'partner' => intval($user->steamid),
'tradeoffermessage' => sprintf(self::NEW_TRADE_OFFER_MESSAGE, $user->name, $type, $type . 'ing'),
'json_tradeoffer' => json_encode($tradeOffer),
'trade_offer_access_token' => json_encode(array('trade_offer_access_token' => $token))
];
$options = [
'headers' => ['Cookie' => $bot->getCookie() . $ability],
'form_params' => $formFields,
];
@Govind13100 awesome, problem was in this param: 'trade_offer_access_token' => json_encode(array('trade_offer_access_token' => $token))
Thank you a lot !!!
@e1sep0 Glad to here that :-)
@Govind13100 can you please make an example of your makeOffer(), mine looks like this but it isn't working.
makeOffer('59c9e6aa18938dfacf61dxxxxx', 'C414830EDAA2E05443255025xxxxxxx', '1527xxxx', 'test', 'Q_0aO666', '1024541xxxx');
And no errors is being displayed what so ever.
I have used this script and i was able to send tradeoffer using makeoffer() , but it doesn't not work when the two users are not friend with each other. Is there any other way to do that,
Any one to suggest how to send tradeoffer without having each other friends on steam community.
Thanks in advance.!!!