我为 soundcloud 创建了一个 php curl 登录,但我很难正确查找和编码 PUT 数据以跟随某人。
//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;
}
我真的只是在尝试所有我能找到的关于 PUT 的东西,但无法弄清楚我发送的实际价值是什么。HttpFox 为 POST 数据显示“_method=PUT”,但我不知道如何找到 PUT 值实际应该是什么。任何方向将不胜感激。
//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);