我目前正在尝试使用 cURL 指令创建一个页面,该指令执行以下操作:
获取以下链接,向其发送 GET 请求,然后检索结果。
http://login.yahoo.com/config/login?login=xxxxxxx&passwd=yyyyyyyy&.done=http://m.yahoo.com/mail
xxxxx - 用户名 yyyyy - 密码
容易,对吧?并不真地。由于要返回的页面旨在自动将您登录到您的 Yahoo Mail 收件箱。
我试过:
<?php
// Get cURL resource
$curl = curl_init();
// Set some options - we are passing in a useragent too here
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'http://login.yahoo.com/config/login?login=xxxxxx&passwd=yyyyyyy&.done=http://m.yahoo.com/mail',
CURLOPT_USERAGENT => 'something-here'
));
// Send the request & save response to $resp
$resp = curl_exec($curl);
// Close request to clear up some resources
curl_close($curl);
echo $resp;
?>
我确实收到了回复,但它的全部内容是雅虎邮箱登录页面。它实际上并不执行登录并检索相关的雅虎收件箱。
我将如何使用 cURL 来做到这一点?