添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I have a Symfony2 project that's about a year old that scrapes a ridiculously awfully coded web page. I am working on a new Symfony2 project, and must use the same scrape methods, but my new project is using updated versions:

Symfony 3.1.* Guzzle 6.2-dev Goutte ^3.1

I use Goutte as well, which you might have heard of. The original error message I got was something about variables in an array, so I changed my configuration variables to an array and it [seemed to] fix the error:

(OLD)

$client = new Client();
$client->getClient()->setDefaultOption('config/curl/'.CURLOPT_SSL_VERIFYHOST, FALSE);
$client->getClient()->setDefaultOption('config/curl/'.CURLOPT_SSL_VERIFYPEER, FALSE); 

(NEW)

$client = new Client();
$client->getClient()->setDefaultOption(array(
    'curl' => array(
            CURLOPT_SSL_VERIFYHOST => FALSE,
            CURLOPT_SSL_VERIFYPEER => FALSE,

That error was replaced with something new, which I cannot for the life of my solve:

URI must be a string or UriInterface

I'm doing:

$login_url = "https://sub.website.com/event/login.jsp"; 
$crawl_login = $client->request('GET', $login_url);//$login_url
$form = $crawl_login->selectButton('loginSubmit')->form();
$form['login']    = $user;
$form['password'] = $pass;
$crawl_login = $client->submit($form);

I've tried doing it this way: (via http://guzzle3.readthedocs.io/http-client/client.html)

$client = new Client(['base_uri' => 'https://foo.com/api/']);
$response = $client->request('GET', 'test');

But to no avail, I still get the same error. So I'm thinking my options are to either get this to work or if possible or change to an older version of guzzle (which I don't know how to do, and yes, I know about the HTTP_PROXY vulnerability).

I don't actually expect anyone to have a solution to this because hardly anyone seems to use Guzzle/Goutte, but it's worth posting and fingers crossed I solve it. Thanks.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.