Documentation / Tutorials / Server

Run PHP scripts using rotating proxies

/ Server / Run PHP scripts using rotating proxies

Sometimes, we want our PHP code to run behind the proxies to hide our IP address.
This tutorial will explain how to set up rotating proxies using a bash script.

Step1:
Create the PHP script which needs to be run behind the proxies.
eg. index.php

Suppose we want to scrap the data fromexample.com and we don’t want to be banned from the example.com site server.

Step2:
Create the proxy.sh file on our server file system.

proxy.sh

make sure your index.php and proxy.sh are in the same folder.

make the proxy.sh file executable by firing this command: chmod u+x proxy.sh

Step3:
to test the functionality run the proxy.sh file using ./proxy.sh command.
now our PHP script will run behind the proxy server.

 

This tutorial will be helpful when you are scraping big data and don’t want to get banned.

Categories
Most Popular

Leave a Reply

Your email address will not be published.