Created
April 15, 2014 14:11
-
-
Save LogIN-/10735936 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function getRemotePage($url){ | |
| require_once(user_agents.inc.php"); | |
| $user_agent = $rand_keys = array_rand($user_agents, 1); | |
| $user_agent = $user_agents[$user_agent]; | |
| $user_ip = long2ip(rand(0, "4294967295")); | |
| // $proxies = array(); // Declaring an array to store the proxy list | |
| // // Adding list of proxies to the $proxies array | |
| // $proxies[] = 'user:password@173.234.11.134:54253'; // Some proxies require user, password, IP and port number | |
| // $proxies[] = 'user:password@173.234.120.69:54253'; | |
| // $proxies[] = 'user:password@173.234.46.176:54253'; | |
| // $proxies[] = '173.234.92.107'; // Some proxies only require IP | |
| // $proxies[] = '173.234.93.94'; | |
| // $proxies[] = '173.234.94.90:54253'; // Some proxies require IP and port number | |
| // $proxies[] = '69.147.240.61:54253'; | |
| $options = array( | |
| CURLOPT_CUSTOMREQUEST => "GET", //set request type post or get | |
| CURLOPT_POST => false, //set to GET | |
| CURLOPT_USERAGENT => $user_agent, //set user agent | |
| CURLOPT_COOKIEFILE => ROOT."temp/cookie.txt", //set cookie file | |
| CURLOPT_COOKIEJAR => ROOT."temp/cookie.txt", //set cookie jar | |
| CURLOPT_RETURNTRANSFER => true, // return web page | |
| CURLOPT_HEADER => false, // don't return headers | |
| CURLOPT_FOLLOWLOCATION => true, // follow redirects | |
| CURLOPT_ENCODING => "", // handle all encodings | |
| CURLOPT_AUTOREFERER => true, // set referer on redirect | |
| CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect | |
| CURLOPT_TIMEOUT => 120, // timeout on response | |
| CURLOPT_MAXREDIRS => 10, // stop after 10 redirects | |
| CURLOPT_REFERER => 'https://www.google.com/search?q='.urlencode($url), | |
| CURLOPT_SSL_VERIFYPEER => false, | |
| CURLOPT_COOKIESESSION => true, | |
| CURLOPT_HTTPHEADER => array("REMOTE_ADDR: ".$user_ip, | |
| "HTTP_FORWARDED: ".$user_ip, | |
| "HTTP_FORWARDED_FOR: ".$user_ip, | |
| "HTTP_X_FORWARDED: ".$user_ip, | |
| "HTTP_X_FORWARDED_FOR: ".$user_ip, | |
| "HTTP_X_FORWARDED_FOR: ".$user_ip, | |
| "DNT: 1") | |
| ); | |
| if (isset($proxies)) { // If the $proxy variable is set, then | |
| $proxy = $proxies[array_rand($proxies)]; | |
| $options[CURLOPT_PROXY] = $proxy; // Set CURLOPT_PROXY with proxy in $proxy variable | |
| } | |
| $ch = curl_init( $url ); | |
| curl_setopt_array( $ch, $options ); | |
| $content = curl_exec( $ch ); | |
| $err = curl_errno( $ch ); | |
| $errmsg = curl_error( $ch ); | |
| $header = curl_getinfo( $ch ); | |
| curl_close( $ch ); | |
| $header['errno'] = $err; | |
| $header['errmsg'] = $errmsg; | |
| $header['content'] = $content; | |
| return $header; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment