Skip to content

Instantly share code, notes, and snippets.

@akccakcctw
Forked from ebuildy/init.sh
Created April 27, 2022 10:13
Show Gist options
  • Select an option

  • Save akccakcctw/4759686e75d0daacce18a124ac6247ec to your computer and use it in GitHub Desktop.

Select an option

Save akccakcctw/4759686e75d0daacce18a124ac6247ec to your computer and use it in GitHub Desktop.

Revisions

  1. akccakcctw renamed this gist Apr 27, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @ebuildy ebuildy revised this gist Nov 23, 2016. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions proxy.php
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,10 @@
    'request_fulluri' => true,
    'verify_peer' => false,
    'verify_peer_name' => false,
    ),
    "ssl"=>array(
    "verify_peer"=>false,
    "verify_peer_name"=>false
    )
    );

  3. @ebuildy ebuildy created this gist Nov 23, 2016.
    1 change: 1 addition & 0 deletions init.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    echo "auto_prepend_file=/opt/www/proxy.php" >> /etc/php5/cli/php.ini
    23 changes: 23 additions & 0 deletions proxy.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    <?php

    $proxy = getenv('http_proxy');

    if (!empty($proxy)) {

    $proxy = str_replace('http://', 'tcp://', $proxy);

    echo "Found a proxy " . $proxy . PHP_EOL;

    $context = array(
    'http' => array(
    'proxy' => $proxy,
    'request_fulluri' => true,
    'verify_peer' => false,
    'verify_peer_name' => false,
    )
    );

    stream_context_set_default($context);
    } else {
    echo "Proxy not found" . PHP_EOL;
    }