i have tell php use proxt settings allow connection website. how can force php script use proxy?
i scraped http proxy , want use them.
i tried adding config.php
stream_context_set_default(['http'=>['proxy'=>'101.66.253.22:8080 ']]);
i tried change function this:
$ch = curl_init(site::link_login); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_encoding, "utf-8"); curl_setopt($ch, curlopt_post, 1);
to this:
$ch = curl_init(site::link_login); curl_setopt($ch, curlopt_proxy, '101.66.253.22:8080'); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_encoding, "utf-8"); curl_setopt($ch, curlopt_post, 1);
but none of wchich works properly. can me?
try make new curl_setopt proxy port.
curl_setopt($ch, curlopt_proxy, "http://proxy.example.com"); //proxy url curl_setopt($ch, curlopt_proxyport, "8080"); // proxy port number
maybe... first check error message
if(curl_exec($ch) === false) { echo 'curl error: ' . curl_error($ch); } else { echo 'operation completed without errors'; }
Comments
Post a Comment