ProxyBroker icon indicating copy to clipboard operation
ProxyBroker copied to clipboard

Server and curl on the same local machine. Can't seem to get this work.

Open bbarclay opened this issue 6 years ago • 4 comments

I use the following command and the server starts up. I can run a proxy find and get a list of proxies. Run one of those proxies through my system and everything works with my script. But it if I try to use 127.0.0.1 on port 8888 to connect to the running proxy server. Nothing works.

proxybroker serve --host 127.0.0.1 --port 8888 --types HTTP HTTPS --lvl High

That starts the server. Server started at http://127.0.0.1:8888 // Then I run this script.

// include the library
require '../Zebra_cURL.php';

// instantiate the Zebra_cURL class
$curl = new Zebra_cURL();

// This proxy works. 
//$curl->proxy('104.248.217.40', '8080');

**// This proxy does not. Which this proxy is my local host.** 
$curl->proxy('127.0.0.1', '8888');

// a simple way of scrapping a page
// (you can do more with the "get" method and callback functions)
echo $curl->scrap('https://google.com', true);

Any help would be great. Thanks

bbarclay avatar Nov 19 '18 19:11 bbarclay

I also get this.

curl: (7) Failed to connect to 127.0.0.1 port 1080: Connection refused

bbarclay avatar Nov 19 '18 21:11 bbarclay

Even though I'm not using 1080 I read somewhere it has something to do with trying to connect through a socket.

bbarclay avatar Nov 19 '18 21:11 bbarclay

So, I'm able to use. export http_proxy=http://127.0.0.1:8888/ which is in the giphy for the documentation. That makes it hard to tell. But I as able to so do this and make it work. Then for a global setting on the Mac. I run nano ~/.curlrc to save it globally. I still cannot figure out why this works in the CLI but when I run some script through php It bypasses CLI proxy settings. I"m getting closer. If you are readying this and know what I'm doing wrong. Please let me know :) Thanks

bbarclay avatar Nov 22 '18 15:11 bbarclay

Check if you have env variable HTTP_PROXY set. In My case, after removing the the environment variable.. 'curl' command executed successfully.

nugguvinay avatar Sep 24 '19 12:09 nugguvinay