halipso / php-steam-tradeoffers

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

Returning NULL #29

Open EasyCompany2020 opened 8 years ago

EasyCompany2020 commented 8 years ago

I'm using this code : `public function makeNewOffer($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_COOKIEJAR, $this->cookiejarfile);
    curl_setopt($c, CURLOPT_COOKIEFILE, $this->cookiejarfile);
    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;

    }`

And calling it via this $steam->makeNewOffer($array['sessionId'], $array['cookies'], '$partnerID', $message = 'HIII', '$accessToken', '$itemID');

All i get is the word null on the webpage.

Anyone got any ideas?

emdy commented 8 years ago

Try to echo steam web page, i think your cookies is not fine. I use only curl_setopt($c, CURLOPT_COOKIE, $cookies); to send cookies and ez works. and lol this is my code :D

EasyCompany2020 commented 8 years ago

I get this http://i.imgur.com/UkPNT2c.png

Echoing the web page like this echo $SteamLogin->view('http://steamcommunity.com/id/PolarisCS');

emdy commented 8 years ago

its wrong - need to see with css and js because than you can see if you are login success or not. I meen with all steam files.. like main page

emdy commented 8 years ago

i already run the site so i sell out script sorry

EasyCompany2020 commented 8 years ago

Huh?

EasyCompany2020 commented 8 years ago

http://i.imgur.com/xpzz9YV.png Btw I am logged in successfully

emdy commented 8 years ago

than ok but with curl you can check it too

EasyCompany2020 commented 8 years ago

Huh?

EasyCompany2020 commented 8 years ago

http://i.imgur.com/ez5pJrd.png CURL is returning my cookies when I ask it to.

emdy commented 8 years ago

$url = 'https://store.steampowered.com/'; $headers = "Cookie: add cookie line"//cookie

$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_POST, 0);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_COOKIE, $headers);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec( $ch );

echo $response;
EasyCompany2020 commented 8 years ago

http://i.imgur.com/r5mYfdS.png

emdy commented 8 years ago

what is your main goal?

EasyCompany2020 commented 8 years ago

To send a trade offer.

emdy commented 8 years ago

you dont need login all the time - cookies stays about 7days

EasyCompany2020 commented 8 years ago

Yes, but when i try to send the trade it returns null. Thats my issue

EasyCompany2020 commented 8 years ago

http://i.imgur.com/8gVMIPq.png

emdy commented 8 years ago

when u login first time?

EasyCompany2020 commented 8 years ago

So I log in > Send a trade offer > Returns Null.

emdy commented 8 years ago

i meen login date first?

EasyCompany2020 commented 8 years ago

Could it return null because the account isn't mobile authenticated?

emdy commented 8 years ago

because u need to whait 7 days

emdy commented 8 years ago

if its new host (ip)

EasyCompany2020 commented 8 years ago

It's not :P

emdy commented 8 years ago

its localhost?

EasyCompany2020 commented 8 years ago

mhm

emdy commented 8 years ago

thats been everyones problem at start

bendahrooge commented 8 years ago

It only returns null when there's a authentication issue. Check and make sure curl is sending correct cookie headers

On Sunday, July 10, 2016, eMDy notifications@github.com wrote:

thats been every body problem at start

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/halipso/php-steam-tradeoffers/issues/29#issuecomment-231607121, or mute the thread https://github.com/notifications/unsubscribe/ACv43pQDA6iweuMFgIjFHjktzDObQXqtks5qUUwtgaJpZM4JIwec .

EasyCompany2020 commented 8 years ago

How do i make sure it is. :P

bendahrooge commented 8 years ago

Try using verbose to output the request to a file, this will show you the output of the request just like if it were run on the command line.

$file = fopen('request.txt', 'w'); curl_setopt($ch,CURLOPT_VERBOSE,true); curl_setopt($ch,CURLOPT_STDERR ,$file);

emdy commented 8 years ago

If you have logen in over 7 days limit than its can be only cookies or skin data.

emdy commented 8 years ago

dont open file and never store cookies in file

emdy commented 8 years ago

use db or.. to store them