<?Php
define('php-steamlogin', true);
require('main.php');
include_once("api/AuthFunctions.php");
/*
$SteamLogin = new SteamLogin(array(
'username' => 'myusernamehere',
'password' => 'mypasswordhere',
'datapath' => dirname(__FILE__)
));
*/
$SteamAuth = new SteamAuth;
if($SteamLogin->success){
$authcode = $SteamAuth->GenerateSteamGuardCode("my_shared_secret_here");
$blank='';
$logindata = $SteamLogin->login($blank,$authcode);
$login_values = array_values($logindata); //[1]=session, [2]=cookies
}
if($SteamLogin->error != '') echo $SteamLogin->error;
function MymakeOffer($SID, $cookies, $partner, $message, $token, $assetid) {
$type = 'POST';
$url = 'https://steamcommunity.com/tradeoffer/new/send';
$steamid = bcadd($partner, '76561197960265728');
$data= array (
'sessionid' => $SID,
'serverid' => '1',
'partner' => $partner,
'tradeoffermessage' => $message,
'trade_offer_create_params' => '{"trade_offer_access_token": "'.$token.'"}',
'json_tradeoffer' => '{
"newversion":true,
"version":2,
"me":{"assets":[{"appid":730,"contextid":"2","amount":1,"assetid":"'.$assetid.'"}],"currency":[],"ready":false},
"them":{"assets":[],"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/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7");
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_REFERER, '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 = var_dump(curl_exec($c));
curl_close($c);
return $return;
}
echo MymakeOffer($login_values[1], $login_values[2], 24xxxxx22, 'testing steam trade offer php', "iIxxRwz-", 7000445017);
?>
这是完整的PHP代码
(PS:
我使用php-steamlogin获取sessionID + cookies github.com/SzymonLisowiec/php-steamlogin/
我使用另一个简单的lib来生成2fa代码github.com/MarlonColhado/SteamGenerateMobileAuthPHP)
{{1}}<顺便说一下,这是我在MymakeOffer中获得并使用的sessionID + cookies i.imgsafe.org/0b5e291701.png
我没有在github上询问,因为ppl没有帮助,只是试图销售代码