0

I created a php curl login for soundcloud but I'm having difficulty finding and coding the PUT data correctly to follow someone.

//login      
function login(){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'https://soundcloud.com/session/'); 
        curl_setopt ($ch, CURLOPT_POST, 1);
        $postData='token=&uid=&login_submitted_via=zoom&username=myusername&password=mypassword&remember_me=on';
        curl_setopt ($ch, CURLOPT_POSTFIELDS, $postData);
        curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cloudcookie.txt');
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        $store = curl_exec ($ch);
        return $ch;
    }

I've really just been trying everything I can find about PUTs but can't figure out what actual value I'm sending. HttpFox shows "_method=PUT" for POST data, but I don't know how to find what the PUT value actually should be. Any direction would be appreciated.

//follow
    curl_setopt($ch, CURLOPT_URL, 'https://soundcloud.com/followings/cnn');
    curl_setopt ($ch, CURLOPT_COOKIEFILE, 'cloudcookie.txt');
    curl_setopt($ch, CURLOPT_REFERER, "http://soundcloud.com/people/");
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1');
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded; charset=UTF-8','Content-Length: 0'));
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); 
    curl_setopt($ch, CURLOPT_POSTFIELDS,'$whatvalue');
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    $chleadresult = curl_exec($ch);
    $chleadapierr = curl_errno($ch);
    $chleaderrmsg = curl_error($ch);
    curl_close($ch);
3
  • I believe you meant "$whatvalue" by '$whatvalue' Sep 11, 2012 at 2:50
  • Yes, I'm not sure "what value" should go there.
    – Alex
    Sep 11, 2012 at 2:55
  • But I think you are sure that you dont want to send literal $whatvalue instead of the value of $whatvalue. Sep 11, 2012 at 3:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.