TabProxy
  • Tutorials
  • Rotating Residential Proxy
    • User & Pass Auth
    • API extraction
  • Unlimited Residential Proxy
    • User& Pass Auth
    • API extraction
  • Static Residential Proxy
    • User & Pass Auth
    • API extraction
  • Dedicated Datacenter Proxy
    • User & Pass Auth
    • API extraction
  • Common Problems
    • IP Whitelist Configuration
    • Enterprise CDK Exchange
    • Sub-user configuration
    • Google extension configuration tutorial
    • pop-up payment
  • Code Examples
    • C/C++
    • GO
    • Node.js
    • PHP
    • JAVA
    • Python
  • Integration Tutorial
Powered by GitBook
On this page
  1. Code Examples

PHP

Example


          <?php
          
          // Target page to visit
                
          $targetUrl = "www.google.com";
                
          // proxy server
                
          $proxyServer = "http://{{ip}:{{domain}}";
                
                
                
          // Tunnel Identity Information
                
          $ch = curl_init();
                
          curl_setopt($ch, CURLOPT_URL, $targetUrl);
                
          curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, false);
                
          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                
                
                
          // Setting up a proxy server
                
          curl_setopt($ch, CURLOPT_PROXYTYPE, 0); //http
                
          // curl_setopt($ch, CURLOPT_PROXYTYPE, 5); //sock5
                
          curl_setopt($ch, CURLOPT_PROXY, $proxyServer);
                
                
                
          // Set Tunnel Verification Information
                
          curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
                
          curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727;)");
                
          curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
                
          curl_setopt($ch, CURLOPT_TIMEOUT, 5);
                
          curl_setopt($ch, CURLOPT_HEADER, true);
                
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                
          $result = curl_exec($ch);
                
          $err = curl_error($ch);
                
                
                
          curl_close($ch);
                
                
                
          var_dump($err);
                
          var_dump($result);
          
PreviousNode.jsNextJAVA

Last updated 1 year ago