因此,我尝试使用 Goutte 登录https网站,但出现以下错误:
cURL error 60: SSL certificate problem: unable to get local issuer certificate
500 Internal Server Error - RequestException
1 linked Exception: RingException
这是 Goutte 的创建者说要使用的代码:
use Goutte\Client;
$client = new Client();
$crawler = $client->request('GET', 'http://github.com/');
$crawler = $client->click($crawler->selectLink('Sign in')->link());
$form = $crawler->selectButton('Sign in')->form();
$crawler = $client->submit($form, array('login' => 'fabpot', 'password' => 'xxxxxx'));
$crawler->filter('.flash-error')->each(function ($node) {
print $node->text()."\n";
});
或者这里是 Symfony 推荐的代码:
use Goutte\Client;
// make a real request to an external site
$client = new Client();
$crawler = $client->request('GET', 'https://github.com/login');
// select the form and fill in some values
$form = $crawler->selectButton('Log in')->form();
$form['login'] = 'symfonyfan';
$form['password'] = 'anypass';
// submit that form
$crawler = $client->submit($form);
问题是它们都不起作用,我收到了上面发布的错误。我可以,但是使用我问过的过去问题中编写的代码登录: cURL Scrape then Parse/Find Specific Content
我只想使用 Symfony/Goutte 登录,这样抓取我需要的数据会更容易。请问有什么帮助或建议吗?谢谢!