postaddictme / instagram-php-scraper

Get account information, photos, videos, stories and comments.
https://packagist.org/packages/raiym/instagram-php-scraper
MIT License
3.1k stars 800 forks source link

Connection refused when using proxy #1113

Closed spapapan closed 1 year ago

spapapan commented 1 year ago

I am trying to connect using a proxy because without it I get this error "InstagramException: Response code is 429. Body: Something went wrong." which I assume happens because other people from the shared server I use are spamming Instagram.

So this is the code I used to connect through a proxy:

$instagram = new \InstagramScraper\Instagram(new \GuzzleHttp\Client());
$instagram::setProxy([
    'address' => '111.112.113.114',
    'port'    => '8080',
    'tunnel'  => true,
    'timeout' => 30,
    'auth' => [
        'user' => 'Vdsk4',
        'pass' => 'XcnR3c',
    ],
]);

This is the error I get:

Fatal error: Uncaught Unirest\Exception: Failed to connect to 111.112.113.114 port 8080 after 1000 ms: Connection refused

I double checked the validity of the proxy and it was ok. What am I doing wrong?

spapapan commented 1 year ago

At the end it was an issue of the server. They had to open the specific port of the proxy.