当我从浏览器访问该页面时,它会要求我登录,登录后会立即显示json。需要做的是使用curl使用php获取json数据。
$username = 'myemail';
$password = 'mypass';
$loginurl = 'https://www.rbauction.com/myaccount';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $loginurl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '_58_login='.$username.'&_58_password='.$password);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $store = curl_exec($ch);
$httpcode = curl_getinfo($ch,CURLINFO_HTTP_CODE);
curl_setopt($ch, CURLOPT_URL, 'https://www.rbauction.com/rba-api/search/results/advanced?rbasq=YXJ8Tj00Mjk0MjM4MzMyKzQyOTQ5NjU3OTg%3D&offset=2&count=1&ccb=USD');
$store = curl_exec($ch);
var_dump($store);
当我执行var_dump时它只显示空字符串