function tor_get_contents($url, $tor_proxy_host = '127.0.0.1', $tor_proxy_port = 9050, $timeout = 300) { $sock = curl_init(); if ($sock == FALSE) { echo 'CURL support missing'; return NULL; } curl_setopt($sock, CURLOPT_PROXY, $tor_proxy_host . ':' . $tor_proxy_port); curl_setopt($sock, CURLOPT_URL, $url); curl_setopt($sock, CURLOPT_HEADER, 1); $agent = random_user_agent(); curl_setopt($sock, CURLOPT_USERAGENT, $agent); curl_setopt($sock, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sock, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($sock, CURLOPT_TIMEOUT, $timeout); curl_setopt($sock, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); $response = curl_exec($sock); if ($response == FALSE) { echo 'TOR not running'; return NULL; } // DEBUG // echo '<pre><tt>'; // print_r ($response); $info = curl_getinfo($sock); // DEBUG // echo '<pre><tt>'; // print_r ($info); curl_close($sock); return $response; }
function curl($url, $posts = "") { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, random_user_agent()); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $icerik = curl_exec($ch); return $icerik; curl_close($ch); }
function curl($url) { $options = array(CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_MAXREDIRS => 10, CURLOPT_USERAGENT => random_user_agent(), CURLOPT_URL => $url); $ch = curl_init(); //Initalising curl; curl_setopt_array($ch, $options); // Setting cURL's options using the previously assigned array data in $options; $data = curl_exec($ch); // Executing cURL; curl_close($ch); return $data; }
function curl() { ini_set('max_execution_time', 0); $this->options = array(CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_FOLLOWLOCATION => FALSE, CURLOPT_CONNECTTIMEOUT => 5000, CURLOPT_TIMEOUT => 5000, CURLOPT_MAXREDIRS => 5000, CURLOPT_USERAGENT => random_user_agent(), CURLOPT_REFERER => "", CURLOPT_URL => $this->url); $this->ch = curl_init(); //Initalising curl; curl_setopt_array($this->ch, $this->options); // Setting cURL's options using the previously assigned array data in $options; $this->data = curl_exec($this->ch); // Executing cURL; curl_close($this->ch); return $this->data; }
function curl_request($options) { global $user_token; $ch = curl_init(); //Constant options... $options[CURLOPT_FOLLOWLOCATION] = true; if (DEBUG_REQUEST) { $options[CURLOPT_HEADER] = true; //used for debugging } $options[CURLINFO_HEADER_OUT] = true; $options[CURLOPT_VERBOSE] = true; $options[CURLOPT_RETURNTRANSFER] = true; $options[CURLOPT_COOKIEJAR] = $_SERVER['DOCUMENT_ROOT'] . '/../tmp/' . $user_token . '_cookies.txt'; //going to look into the effects of this.. $options[CURLOPT_COOKIEFILE] = $_SERVER['DOCUMENT_ROOT'] . '/../tmp/' . $user_token . '_cookies.txt'; //Randomize user agent if it's not set if (!isset($options[CURLOPT_USERAGENT])) { $options[CURLOPT_USERAGENT] = random_user_agent(); } //set all options, both constant and user supplied. curl_setopt_array($ch, $options); $response = curl_exec($ch); if (DEBUG_REQUEST || !trim($response) || curl_error($ch)) { $error = ''; $info = curl_getinfo($ch); if ($info['request_header']) { $error .= $info['request_header'] . ' yielded '; } if (trim($response)) { $error .= 'response: ' . htmlspecialchars($response); } else { $error .= 'no response'; } if ($curl_error = curl_error($ch)) { $error .= ' with curl error: ' . $curl_error; } trigger_error($error); } curl_close($ch); return $response; }
public function __construct($url, $path = null, $cookieKey = null, $postData = null) { $this->ch = curl_init($url); curl_setopt($this->ch, CURLOPT_HEADER, 0); //output headers curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true); // Allow for redirects. //set cookies to crawl image faster (maybe ^^) if ($cookieKey) { $cookie_file = './cookies_' . $cookieKey . '.txt'; //curl_setopt($this->ch, CURLOPT_COOKIESESSION, true); curl_setopt($this->ch, CURLOPT_COOKIEFILE, $cookie_file); curl_setopt($this->ch, CURLOPT_COOKIEJAR, $cookie_file); } //set post data if ($postData) { curl_setopt($this->ch, CURLOPT_POST, 1); curl_setopt($this->ch, CURLOPT_POSTFIELDS, $postData); } //set time out if ($path) { curl_setopt($this->ch, CURLOPT_HTTPHEADER, ['Accept-Encoding:gzip, deflate']); curl_setopt($this->ch, CURLOPT_TIMEOUT, 120); // times out after 2' } else { curl_setopt($this->ch, CURLOPT_TIMEOUT, 60); // times out after 1' } curl_setopt($this->ch, CURLOPT_USERAGENT, random_user_agent()); if ($path == null) { //just get content curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1); //return html } else { //write file to path corresponding $this->fp = fopen($path, 'w'); curl_setopt($this->ch, CURLOPT_FILE, $this->fp); } //set header send to servers curl_setopt($this->ch, CURLOPT_HTTPHEADER, ['Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Language:en-US,en;q=0.8,vi;q=0.6']); }
function misc_exec_wget($url, $output_path = '.', $noclobber = 0, $wget_path = '/usr/local/bin/wget', $wget_opts = '', $debug = 0) { // global $wget_path; // global $wget_opts; // $debug = 0; // DEBUG // echo $url."\n"; if ($noclobber == 1) { if (file_exists($output_path)) { echo 'WARNING: file ' . $output_path . ' exists, skipping' . "\n"; return 1; } // DEBUG // echo $output_path."\n"; } // download $p = $wget_path . ' ' . $wget_opts . ' -U "' . random_user_agent() . '" "' . $url . '" -O "' . $output_path . '"'; // DEBUG if ($debug == 1) { echo $p . "\n"; } if ($debug == 1) { echo misc_exec($p, $debug); } else { misc_exec($p, $debug); } return 0; }
/** * submitting the trial request to the registration form * * @author Chris Lin <Chris#skiddie.me> * @link https://forms.netsuite.com/app/site/hosting/scriptlet.nl?script=214&deploy=1&compid=663271&h=f545d011e89bdd812fe1 * @param array $profile the applicant's contact information * @param array $hidden the hidden fields in this form * @version 2014-02-16 */ public function submit_trial_request($profile, $hidden = NULL) { echo "[+] preparing the registration payload .. "; $payload = array('custparamfirstname' => $profile['first_name'], 'custparamlastname' => $profile['last_name'], 'custparamtitle' => $profile['title'], 'custparamcompanyname' => $profile['company_name'], 'custparamcountry' => 'TW', 'custparamstate' => 0, 'custparamuse' => 'Business', 'custparamphone' => $profile['phone'], 'custparamemail' => $profile['email'], 'custparamleadsource' => empty($hidden) ? 443597 : $hidden['custparamleadsource'], 'submitted' => '', 'custparamreturnpath' => empty($hidden) ? 'https://localhost:3790/setup/activation' : $hidden['custparamreturnpath'], 'custparamproduct_key' => '', 'custparamproductaxscode' => empty($hidden) ? 'msY5CIoVGr' : $hidden['custparamproductaxscode'], 'custparamthisIP' => long2ip(rand(0, 255 * 255) * rand(0, 255 * 255))); echo "DONE !\n"; echo "[+] configuring the CURL options .. "; $headers = array('User-Agent' => random_user_agent()); foreach ($headers as $key => $value) { $this->curl_resource->setHeader($key, $value); } echo "DONE !\n"; # sending the POST request to retrieve the HTML raw code echo "[+] sending the registration data to online form .. "; $this->curl_resource->post($this->form_address, http_build_query($payload)); echo "DONE !\n"; }
function curl($url) { $options = array(CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_MAXREDIRS => 10, CURLOPT_USERAGENT => random_user_agent(), CURLOPT_URL => $url); $ch = curl_init(); //Initalising curl; curl_setopt_array($ch, $options); // Setting cURL's options using the previously assigned array data in $options; $data = curl_exec($ch); // Executing cURL; curl_close($ch); //Data sent back from cURL to be sorted with Regular Expression //GET VENUE // $replace = str_replace("<", " ", $data); $content = str_replace(">", " ", $replace); $newcontent = str_replace('value="', "rzk", $content); //Giving value a marker if (isset($_GET['id']) && isset($_GET['event'])) { $newcontent2 = str_replace('date=', "rzk", $content); $change = preg_match_all("~rzk\\d+~", $newcontent2, $arr); for ($i = 0; $i < count($arr); $i++) { $array[] = str_replace("rzk", "", $arr[$i]); } for ($i = 0; $i < count($array[0]); $i++) { $split[] = str_split($array[0][$i], 1); } for ($i = 0; $i < count($array[0]); $i++) { $test[$i]["year"] = $split[$i][0] . $split[$i][1] . $split[$i][2] . $split[$i][3]; $test[$i]["month"] = $split[$i][4] . $split[$i][5]; $test[$i]["day"] = $split[$i][6] . $split[$i][7]; $test[$i]["time"] = $split[$i][8] . $split[$i][9] . ":" . $split[$i][10] . $split[$i][11]; } if ($content) { //return json_encode($test); return json_encode($test); } } else { if (isset($_GET['id'])) { $newcontent2 = str_replace('value=\'', "rzk", $content); $moviename = preg_match_all("~rzk\\d+\\'\\s\\w+[^/]*~", $newcontent2, $arr2); for ($i = 0; $i < count($arr2[0]); $i++) { $movie[$i] = str_replace("rzk", "", $arr2[0][$i]); } for ($i = 0; $i < count($arr2[0]); $i++) { $movies[$i] = str_replace("'", "", $movie[$i]); } for ($i = 0; $i < count($movies); $i++) { if (preg_match("~\\d+~", $movies[$i], $arr3)) { $m[$i]['num'] = $arr3; } if (preg_match("~\\s\\w+[^/]*~", $movies[$i], $arr4)) { $m[$i]['title'] = $arr4; #$arr4[$i]['title'] = $m[$i]['title'][0]; } // preg_match_all("~w+~", $movies[$i], $arr3[0]['title']); } for ($i = 0; $i < count($m); $i++) { $arr6[$i]['num'] = $m[$i]['num'][0]; $arr6[$i]['title'] = $m[$i]['title'][0]; } $arr6[0]['iden'] = $_GET['id']; echo json_encode($arr6); } else { #$change = preg_match_all("~date=\d+~", $content, $arr) ; $change = preg_match_all("~rzk\\w+~", $newcontent, $arr); for ($i = 0; $i < count($arr[0]); $i++) { $springclean[] = str_replace("rzk", "", $arr[0][$i]); } $venue = []; $rez = []; for ($i = 0; $i < count($springclean); $i++) { if (array_search($springclean[$i], $rez, true) === false) { $rez[] = $springclean[$i]; } } for ($i = 0; $i < count($rez); $i++) { if ($rez[$i] != "SelectDate") { $venue[$i]["venue"] = $rez[$i]; } } if ($springclean) { #var_dump(json_encode($venue)); return json_encode($venue); } } } }
require_once 'misc/rss.php'; require_once 'misc/sql.php'; require_once 'misc/misc.php'; require_once 'misc/youtube.php'; //require_once ('misc/wikipedia.php'); require_once 'misc/widget_media.php'; require_once 'rsscache_misc.php'; require_once 'rsscache_sql.php'; require_once 'rsscache_output.php'; // main () // remove timezone warning //$tz = date_default_timezone_get (); //date_default_timezone_set ('UTC'); // set user agent for downloads ini_set('user_agent', random_user_agent()); $rsscache_user_agent = random_user_agent(); $debug = 0; $c = rsscache_get_request_value('c'); // category $f = rsscache_get_request_value('f'); // function $output = rsscache_get_request_value('output'); // output if (!$output) { $output = $rsscache_default_output; } $q = rsscache_get_request_value('q'); // search query $item = rsscache_get_request_value('item'); // item crc32 $start = rsscache_get_request_value('start');