Goutte
Goutte copied to clipboard
How to set proxy in new version?
Hi I want use http proxy in new version of Goutte client. How to set proxy in new version?
Hi
I'm using like this:
use Goutte\Client;
use Symfony\Component\HttpClient\HttpClient;
$client = new Client(HttpClient::create(['proxy' => $proxy]));
And it's working. In any case, test it.
Hopes this help.
@restucciaquito I tried the above and I receive a HttpClient error that the proxy couldn't connect to the TARGET_URL not the proxy itself. However any tip would is appreciated.
Symfony\Component\HttpClient\Chunk\ErrorChunk::isFirst :64
vendor/symfony/http-client/Chunk/ErrorChunk.php:64
Symfony\Component\HttpClient\Exception\TransportException
Couldn't connect to server for TARGET_URL
For recent versions use: Goutte Client instance (which extends Symfony\Component\BrowserKit\HttpBrowser)
use Symfony\Component\HttpClient\HttpClient;
use Goutte\Client;
$client = new Client(HttpClient::create(['proxy' => 'http://xx.xx.xx.xx:80']));
...
@restucciaquito I tried the above and I receive a HttpClient error that the proxy couldn't connect to the TARGET_URL not the proxy itself. However any tip would is appreciated.
Symfony\Component\HttpClient\Chunk\ErrorChunk::isFirst :64 vendor/symfony/http-client/Chunk/ErrorChunk.php:64 Symfony\Component\HttpClient\Exception\TransportException Couldn't connect to server for TARGET_URL
Hello, Same error there. Whats wrong with that: use Symfony\Component\HttpClient\HttpClient; use Goutte\Client;
$client = new Client(HttpClient::create(['proxy' => 'http://xx.xx.xx.xx:80']));