Answer the question
In order to leave comments, you need to log in
How to work with proxy in cUrl?
How to use http/s socks in cUrl?
Links are not interesting, specific examples of use are interesting.
I'm trying to send a request from an http proxy with authorization, the response is "empty"
<?php
function get($url) {
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, trim($url));
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, '30.148.96.136:55575');
curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'INST0012:DoJeg5');
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.1) Gecko/2008070208');
$res=curl_exec($ch);
curl_close($ch);
return $res;
}
$buf = get('https://www.instagram.com/petukhov_serega/');
echo $buf;
echo 'Пусто';
?>
Answer the question
In order to leave comments, you need to log in
Try like this:
if(curl_exec($ch) === false) {
return 'Ошибка: ' . curl_error($ch);
}
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question