Start a new topic

Curl request php don't work

Getting the 407 error

I'm using the example from the page

Running docker container with alpine

php 7.4

$ch = curl_init();

$url = '';
$proxy = '';
$proxy_auth = 'https://SECRET:';

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_auth);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 180);
curl_setopt($ch, CURLOPT_CAINFO, '/var/www/html/.docker/certificate/zyte-proxy-ca.crt'); // required for HTTPS
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); //required for HTTPS

$scraped_page = curl_exec($ch);

HTTP/1.1 200 OK

HTTP/1.1 407 Proxy Authentication Required

X-Crawlera-Error: bad_proxy_auth

X-Crawlera-Version: 1.50.5

Proxy-Authenticate: Basic realm="Crawlera"

Content-Length: 0

Date: Wed, 28 Jul 2021 21:05:42 GMT

Proxy-Connection: close

Connection: close

if i use the curl request in commandline, it just work. Whats the differents and how can i fix this ?

i checked the credentials 100 times...

Login to post a comment