Php 如何从痛风改变口吻属性?

Php 如何从痛风改变口吻属性?,php,guzzle,goutte,Php,Guzzle,Goutte,当我运行上面的代码时,我得到一个错误:当没有类作用域处于活动状态时,无法访问父::。那么,如何从痛风中获取狂饮属性呢 示例的开头似乎假设您正在编写Goutte客户端类的扩展。如果您只是在使用该类,则代码段更像: <?php require_once '/var/www/goutte.phar'; use Goutte\Client; $guzzle = parent::getClient(); //You'll want to pull the Guzzle client out

当我运行上面的代码时,我得到一个错误:当没有类作用域处于活动状态时,无法访问父::。那么,如何从痛风中获取狂饮属性呢

示例的开头似乎假设您正在编写Goutte客户端类的扩展。如果您只是在使用该类,则代码段更像:

<?php
require_once '/var/www/goutte.phar';
 use Goutte\Client; 


 $guzzle = parent::getClient(); //You'll want to pull the Guzzle client out of Goutte to inherit its defaults
$guzzle->setDefaultOption('verify', '/path/to/cacert.pem'); //Set the certificate at @mtdowling recommends
$client->setClient($guzzle); //Tell Goutte to use your modified Guzzle client 

$crawler = $client->request('GET', 'https://ocean.ac-guadeloupe.fr/publinet/resultats'); //Proceed as you were
var_dump($crawler);
?>

我不知道你为什么被否决。我在让goutte绕过一些ssl自我认证问题时遇到了问题。我按照你说的做了,但把“验证”、“路径/到/证书”改为“验证”,结果是错误的,效果很好。
$client = new Client();
$guzzle = $client->getClient(); //You'll want to pull the Guzzle client out of Goutte to inherit its defaults

$guzzle->setDefaultOption('verify', '/path/to/cacert.pem'); //Set the certificate at @mtdowling recommends
$client->setClient($guzzle); //Tell Goutte to use your modified Guzzle client 

$crawler = $client->request('GET', 'https://ocean.ac-guadeloupe.fr/publinet/resultats'); //Proceed as you were
var_dump($crawler);