PHP Classes

How to Find Proxy Servers with PHP to Send a Request to Another Server - Tor PHP Get Proxy List package blog

Recommend this page to a friend!
  All package blogs All package blogs   Tor PHP Get Proxy List Tor PHP Get Proxy List   Blog Tor PHP Get Proxy List package blog   RSS 1.0 feed RSS 2.0 feed   Blog How to Find Proxy Ser...  
  Post a comment Post a comment   See comments See comments (1)   Trackbacks (0)  

Author:

Package: Tor PHP Get Proxy List

Sometimes it is necessary to work around network constraints and use a proxy server to send HTTP requests to remote server.

A PHP script can be used to send any HTTP requests via a given server.

If you do not have access to a your own proxy server, you can try using the Proxy IP List site to find available servers.




Loaded Article

In this article you can learn about:

What is a HTTP Proxy Server?

Why You Would Need to Use a HTTP Proxy Server?

How Can You Use the Tor PHP Get Proxy List package to Get a List of Available Proxy Servers?


How to Find Proxy Servers with PHP to Send a Request to Another Server

What is a HTTP Proxy Server?

A proxy server is computer accessible from the Internet that can be used to forward network connections to another computer also on the Internet.

There are several types of proxy servers. If you want to use a proxy server to access a Web page from another site, you need to use a HTTP server.

Why You Would Need to Use a HTTP Proxy Server?

Sometimes you need to use a computer from a project that is in a network that is not configured to be able accessing any other computer on the Internet.

This may happen in different circumstances. For instance, sometimes the Internet network nodes need to be reconfigured to perform changes in the routing of communications between different computers.

Although in this case it may be a temporary situation, you may not be able to wait until the network routing is sorted.

How Can You Use the Tor PHP Get Proxy List package to Get a List of Available Proxy Servers?

The use of this package is pretty simple. Just put the class script in a Web server that you control and just by accessing the page with torgetproxy.php script.

You can also run the script using PHP from the command line like this:

php torgetproxy.php

This will make it output a list of proxy servers obtained from the Proxy IP List Web site. It will output a list like this:

Array
(
    [0] => 187.85.196.96:8080
    [1] => 105.174.5.146:8080
    [2] => 183.88.114.86:8080
    [3] => 202.73.51.146:80
    [4] => 92.222.107.29:3128
    [5] => 92.222.109.68:3128
    [6] => 92.222.107.153:3128
    [7] => 203.37.37.143:80
    [8] => 47.89.51.239:8088
    [9] => 201.87.244.1:5555
    [10] => 190.15.200.31:8080
    [11] => 124.120.239.54:8080
    [12] => 5.135.204.109:3128
    [13] => 92.222.107.181:3128
)

Then you just pick a proxy server from the list and pass it to a PHP script that you can run like you can see below. You need to copy the list of proxy servers removing the square brackets and adding quotes to the proxy server addresses.

<?php
    $list =
    Array
    (
        0 => '187.85.196.96:8080',
        1 => '105.174.5.146:8080',
        2 => '183.88.114.86:8080',
        3 => '202.73.51.146:80',
        4 => '92.222.107.29:3128',
        5 => '92.222.109.68:3128',
        6 => '92.222.107.153:3128',
        7 => '203.37.37.143:80',
        8 => '47.89.51.239:8088',
        9 => '201.87.244.1:5555',
        10 => '190.15.200.31:8080',
        11 => '124.120.239.54:8080',
        12 => '5.135.204.109:3128',
        13 => '92.222.107.181:3128',
    )
    ;

    $url = 'https://www.phpclasses.org/';
    foreach($list as $proxy)
    {
        $proxy_string = "tcp://" . $proxy;
        $options = array(
            'http' => array(
                'proxy' => $proxy_string,
                'timeout'=>3
            )
        );
        $context = stream_context_create($options);
        echo "Trying to access page ". $url.
            " using proxy server ".$proxy."... ";
        flush();
        $page = @file_get_contents( $url, false, $context);
        if($page !== false)
        {
            echo "Succeeded!\n";
            break;
        }
        echo "Failed!\n";
    }
    if($page === false)
        echo "It was not possible to fetch the page ".$url.
           " with any of the listed proxy servers.\n";
    else
        echo "The page ".$url." was retrieved with success. "."
            "It has a length of ".strlen($page)." bytes.\n";
?>

About the Tor PHP Get Proxy List Package

The package Tor PHP Get Proxy List is one of the few PHP packages that was considered notable recently because it does something that is worth paying attention.

The basic purpose is: Get the list of proxy servers from Proxy IP list

Here follows in more detail what it does:

This class can get the list of proxy servers Proxy IP list site.

It can send a HTTP request to get the page with the proxy servers list from Proxy-Ip-List.com site.

The class parsers the retrieved pages and returns the proxy servers addresses in an array.

Conclusion

The Tor PHP Get Proxy List can be downloaded from download page or be installed using the PHP Composer tool following instructions in the Composer install instructions page.

This package was considered notable for implementing its benefits in a way that is worth noticing.

Notable PHP packages can be often considered innovative. If this package is also innovative, it can be nominated to the PHP Innovation Award and the author may win prizes and recognition for sharing innovative packages.

If you also developed your own notable or innovative packages consider sharing them, so you can also earn more visibility for your package as well nice prizes.

One nice prize that many PHP developers want and you may like is the PHP elePHPant mascot plush.




You need to be a registered user or login to post a comment

1,611,040 PHP developers registered to the PHP Classes site.
Be One of Us!

Login Immediately with your account on:



Comments:

1. How to find Proxy - Sam clerk (2021-04-14 07:57)
Get a vpn... - 0 replies
Read the whole comment and replies



  Post a comment Post a comment   See comments See comments (1)   Trackbacks (0)  
  All package blogs All package blogs   Tor PHP Get Proxy List Tor PHP Get Proxy List   Blog Tor PHP Get Proxy List package blog   RSS 1.0 feed RSS 2.0 feed   Blog How to Find Proxy Ser...