public function main() { // load CURL class require dirname(__FILE__) . '/lib/CURL.php'; // iterator over hashes foreach ($this->hashes as $index => $hash) { // check if csv line data $fields = str_getcsv($hash, ';'); if (count($fields) > 1) { $this->out('Trying hash: ' . implode(', ', $fields) . ' … ', false); $hash = $fields[count($fields) - 1]; } else { $this->out('Trying hash: ' . $hash . ' … ', false); } // use curl to send request to md5crack $CURL = new CURL('http://md5crack.com/crackmd5.php', array(CURLOPT_POSTFIELDS => array('term' => $hash, 'crackbtn' => true))); // search for result string if (preg_match('@Found:\\s+md5\\("(?P<source>.+)"\\)\\s=\\s+([a-z0-9]+)@mi', $CURL->read(), $found)) { $this->out($found['source']); } else { $this->out('not found'); } } $this->quit('done!'); }
public function getPlayByPlay() { $url = $this->getPlayByPlayUrl($this->id); $curl = new CURL(); $curl->addSession($url); $page = $curl->exec(); $curl->clear(); $this->playByPlay = new SimpleXMLElement($page); return $this->playByPlay; }
public function __construct($user, $apikey) { $this->user = $user; $this->apikey = $apikey; $this->data = array('api_key' => &$this->apikey, 'user' => &$this->user); return parent::__construct($this->url); }
/** * @return mixed */ protected function _fetchFromApi() { // create request $curl = \CURL::init($this->_getUrl())->addHttpHeader('Content-type', 'application/json')->setPost(TRUE)->setPostFields($this->_getDataAsJson())->setReturnTransfer(TRUE); // use proxy if ($this->hasProxy()) { $curl->setProxy($this->getProxyHost())->setProxyPort($this->getProxyPort()); } // send request $response = $curl->execute(); // decode json data $data = json_decode($response, TRUE); // response exception for not json object if (is_null($data)) { $data = $response; } // valid json-rpc response if (!isset($data['result'])) { // Log errors from service error_log(var_export($data, true)); return ['error' => $data]; } // and out return $data['result']; }
protected function get_jsapi_ticket() { $url = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=' . $this->access_token . '&type=jsapi'; $param = array('appid' => $this->appid, 'secret' => $this->appsecret); $ret = CURL::get($url, $param); return $ret; }
public function Revert($url) { parent::Revert($url); $this->SetHeader('Accept', 'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'); $this->SetHeader('User-Agent', 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.231 Safari/534.10'); $this->SetHeader('Accept-Language', 'en-US,en;q=0.8'); $this->SetHeader('Accept-Encoding', 'gzip,deflate,sdch'); }
public function verify_sign($params) { if (empty($params)) { return false; } $mysign = $this->create_sign($params); $responseTxt = 'true'; if (!empty($params["notify_id"])) { $notify_id = $params["notify_id"]; $transport = strtolower(trim($this->_config['transport'])); $partner = $this->_config['partner']; if ($transport == 'https') { $veryfy_url = 'https://mapi.alipay.com/gateway.do?service=notify_verify&'; } else { $veryfy_url = 'http://notify.alipay.com/trade/notify_query.do?'; } $veryfy_url .= 'partner=' . $partner . '¬ify_id=' . $notify_id; $responseTxt = CURL::get($veryfy_url, '', array(CURLOPT_CAINFO => '')); } if (preg_match("/true\$/i", $responseTxt) && $mysign == $params["sign"]) { return true; } else { throw new Kohana_Exception('alipay 即时到帐支付 验证错误:' . $mysign . '--' . $params["sign"]); return false; } }
public static function init() { if (!self::$curl) { self::$curl = curl_init(); } curl_setopt(self::$curl, CURLOPT_RETURNTRANSFER, TRUE); //获取到数据后不直接打印出来 }
/** * Test if the user is authenticated * * @return bool TRUE if he is; FALSE otherwise */ public function is_authenticated() { if (file_exists(__DIR__ . '/../' . CURL::$COOKIE_FILE_PATH)) { $cookie = CURL::cookie(); return isset($cookie->auth) && $cookie->auth->expiration >= time(); } return false; }
protected function sendRequest($url, $user, $password) { if ($this->printEnabled) { echo 'API request: ', $url, PHP_EOL; } if ($this->logEnabled) { $this->log[] = $url; } $curl = new CURL(); $curl->addOption(CURLOPT_USERPWD, $user . ':' . $password); $curl->addOption(CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-type: application/json')); $curl->addOption(CURLOPT_HEADER, true); $data = $curl->get($url); if ($curl->getRequestInfo('http_code') != 200) { $e = 'ERROR: ' . PHP_EOL; $e .= "\trequest URL:\t\t" . $url . PHP_EOL; $e .= "\trequest response:\t" . $curl->getRequestInfo('response_body') . PHP_EOL; if ($this->printEnabled) { echo $e; } if ($this->logEnabled) { $this->log[] = $e; } return false; } else { return $data; } }
private function execute($endpoint, $method, $payload, $headers = array()) { $curl = CURL::newCURL($endpoint, $method); $request = Request::newRequest($payload, $headers); $response = $curl->send($request); $object = $this->convert($response); unset($curl); return $object; }
public function action_zz2() { $str = ''; $content = trim($_GET['q']); $ret_json = CURL::get('http://rmbz.net/Api/AiTalk.aspx?key=rmbznet&word=' . $content); $ret_array = json_decode($ret_json, true); if (isset($ret_array['result']) && $ret_array['result'] == 1) { $str = $ret_array['content']; } $this->response['data'] = $str; }
public function procesaLinea($csv, $lineaCSV) { $cnx = new CURL(); $code = "ERRO"; try { // Ler URL da liña do CSV $url = trim($lineaCSV[1]); $param = array("url" => $url); // Abrir URL $info = $cnx->open_url($param); $data = $param[0]; $code = $info["http_code"]; } catch (Exception $e) { $log = array("data" => date("YmdHis"), "linea" => json_encode($lineaCSV), "excepcion" => $e->getMessage()); $this->trace_error($log); } // finally: engadir columnas ao CSV array_push($lineaCSV, $code); //fputcsv — Dar formato CSV a una línea y escribirla en un puntero a un fichero fputcsv($csv, $lineaCSV, ","); }
public function __call($method, $args) { $method = explode('_', $method); $method = array_reverse($method); $method = implode('/', $method); $data = $args[0]; $url = 'https://api.weixin.qq.com/cgi-bin/' . $method . '?access_token=' . $this->access_token; $param = json_encode($data, JSON_UNESCAPED_UNICODE); $ret_json = CURL::post($url, $param); $ret_array = json_decode($ret_json, true); return $ret_array; }
public function getAll() { $result = array(); $html = file_get_html("http://www.eps.uam.es/esp/alumnos/lab_horario.php?horario_id=17&semestre=S2"); $e = $html->find('select'); $e = $e[0]; $curl = new CURL(); $opts = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true); foreach ($e->find('option') as $g) { $result[] = array("id" => $g->value, "name" => $g->innertext); $id = $g->value; $curl->addSession("http://www.eps.uam.es/esp/alumnos/lab_horario.php?local_id={$id}&horario_id=17&semestre=S2", $opts); } // Ejecuta todas las peticiones en paralelo $pages = $curl->exec(); $curl->clear(); for ($i = 0; $i < sizeof($pages); $i++) { $result[$i]["data"] = Laboratorio::get($result[$i]["id"], $page); } return $result; }
public function findPlayer($player) { $results = array(); print_r($this->getSearchUrl($player)); $curl = new CURL(); $curl->addSession($this->getSearchUrl($player)); $curl->setOpt(CURLOPT_RETURNTRANSFER, 1); $curl->setOpt(CURLOPT_REFERER, 'http://lh.beta.smallballstats.info'); $page = $curl->exec(); $curl->clear(); $page = json_decode($page); foreach ($page->responseData->results as $result) { array_push($results, array('url' => $result->unescapedUrl, 'title' => $result->titleNoFormatting, 'content' => $result->contentNoFormatting)); } sleep(1); $curl = new CURL(); $curl->addSession($this->getSearchUrl($player, 4)); $curl->setOpt(CURLOPT_RETURNTRANSFER, 1); $curl->setOpt(CURLOPT_REFERER, 'http://lh.beta.smallballstats.info'); $page = $curl->exec(); $curl->clear(); $page = json_decode($page); foreach ($page->responseData->results as $result) { array_push($results, array('url' => $result->unescapedUrl, 'title' => $result->titleNoFormatting, 'content' => $result->contentNoFormatting)); } print_r($results); die; }
/** * Login into pyLoad * * @param string $username Username * @param string $password Password * @return string Session ID * @throws \Exception */ public function login($username, $password) { if (!is_null(PyLoad::getInstance()->getSession())) { return PyLoad::getInstance()->getSession(); } $curl_opts[CURLOPT_POST] = true; $curl_opts[CURLOPT_POSTFIELDS] = array('username' => $username, 'password' => $password); $curl_opts[CURLOPT_HTTPHEADER] = array('Content-Type: multipart/form-data'); $session = CURL::exec('login', $curl_opts); $session = str_replace('"', '', $session); PyLoad::getInstance()->setSession($session); return $session; }
/** * @param $path * @param array $params * * @return array|bool * @throws GplusException */ public static function post($path, $params = []) { if (!empty($params)) { $url = self::_getCleanDomain(GplusConstants::DOMAIN_ACCOUNTS) . '/' . self::_getCleanPath($path); // talk to google $responseJson = \CURL::init($url)->setPostFields(http_build_query($params))->setReturnTransfer(TRUE)->execute(); // parse response $response = json_decode($responseJson, TRUE); if ($response !== NULL) { if (isset($response['error'])) { throw new GplusException(GplusErrorConstants::REQUEST_ERROR_MESSAGE, GplusErrorConstants::REQUEST_ERROR_CODE, $response); } return (array) $response; } } return FALSE; }
public static function parse($feed, $limit = 0) { // Check if SimpleXML is installed if (!function_exists('simplexml_load_file')) { throw new Kohana_Exception('SimpleXML must be installed!'); } // Make limit an integer $limit = (int) $limit; // Disable error reporting while opening the feed $error_level = error_reporting(0); // Allow loading by filename or raw XML string if (Valid::url($feed)) { // Use native Request client to get remote contents $feed = CURL::get($feed); //$feed = HTTP::get($feed); } elseif (is_file($feed)) { // Get file contents $feed = file_get_contents($feed); } //var_dump($feed); // Load the feed $feed = simplexml_load_string($feed, 'SimpleXMLElement', LIBXML_NOCDATA); // Restore error reporting error_reporting($error_level); // Feed could not be loaded if ($feed === FALSE) { return array(); } $namespaces = $feed->getNamespaces(TRUE); // Detect the feed type. RSS 1.0/2.0 and Atom 1.0 are supported. $feed = isset($feed->channel) ? $feed->xpath('//item') : $feed->entry; $i = 0; $items = array(); foreach ($feed as $item) { if ($limit > 0 and $i++ === $limit) { break; } $item_fields = (array) $item; // get namespaced tags foreach ($namespaces as $ns) { $item_fields += (array) $item->children($ns); } $items[] = $item_fields; } return $items; }
public static function transfers($params) { $url = 'https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers'; $params['mchid'] = self::$config['mch_id']; //微信支付分配的商户号 1900000109 $params['mch_appid'] = self::$config['wxappid']; //微信分配的公众账号ID(企业号corpid即为此appId) wx8888888888888888 $params['spbill_create_ip'] = self::get_client_ip(); //调用接口的机器Ip地址 $params['check_name'] = 'NO_CHECK'; $params['nonce_str'] = self::random(16); $params['sign'] = self::sign($params); $opts = array(CURLOPT_SSLCERT => 'apiclient_cert.pem', CURLOPT_SSLKEY => 'apiclient_key.pem', CURLOPT_CAINFO => 'rootca.pem'); $params_xml = self::array2xml($params); $ret_xml = CURL::post($url, $params_xml, $opts); $ret_array = self::xml2array($ret_xml); return $ret_array; }
public function getContent($depth = 0, $callback) { $this->content = CURL::get($this->url); $this->content = mb_convert_encoding($this->content, 'utf-8', 'GBK,UTF-8,ASCII'); if ($this->reg_url && preg_match($this->reg_url, $this->url, $matches)) { self::getTitle($this->content); if ($this->reg_content) { $html = SimpleHtml::str_get_html($this->content); call_user_func($callback, $this->url, $this->title, $html->find($this->{$reg_content}, 0) ? $html->find($this->{$reg_content}, 0)->innertext : $this->content); return null; } call_user_func($callback, $this->url, $this->title, $this->content); } if ($depth < $this->depth) { $links = self::getCurPageLinks($this->content); foreach ($links as $link) { \Log::info($link); $this->url = self::addDomainForURL($this->url, $link); self::getContent($depth + 1, $callback); } } }
public function get_user_info() { $wx_user_info = Cookie::get('wx_user_info'); if (!empty($wx_user_info)) { return json_decode($wx_user_info, true); } if (empty($_GET['code'])) { return array(); } $code = $_GET['code']; $ret_array = $this->get_access_token($code); if (isset($ret_array['errcode'])) { return $ret_array; } $openid = $ret_array['openid']; $access_token = $ret_array['access_token']; $url = 'https://api.weixin.qq.com/sns/userinfo'; $param = array('access_token' => $access_token, 'openid' => $openid, 'lang' => 'zh_CN'); $ret_json = CURL::get($url, $param); $ret_array = json_decode($ret_json, true); Cookie::set('wx_user_info', $ret_json, 86400); return $ret_array; }
function getrank($url) { $url = 'info:' . $url; $ch = $this->GoogleCH($this->strord($url)); $curl = new CURL('http://www.google.com/search?client=navclient-auto&ch=6' . $ch . '&features=Rank&q=' . urlencode($url)); $response = trim($curl->exec(true, false)); var_dump($response); $rank = (int) substr(strrchr($response, ':'), 1); return $rank; }
function grab_rosinst($yaheader, $agentstr) { $proxyUrl = "http://rosinstrument.com/proxy/plab100.xml"; $curl = new CURL(); // create the curl instance $opts = $this->setBrowser(0, 0, $yaheader, $agentstr); // do not set first variable to 1; we don't need infinite looping $curl->retry = MAX_RETRYS; $curl->addSession($proxyUrl, $opts[0]); $result = $curl->exec(); // this is the site returned $curl->clear(); // remove the curl instance unset($curl); // unset curl if (is_array($result)) { $result = $result[0]; if (isset($result[1])) { $result .= $result[1]; } } $goodmatches = array(); $matches = array(); $yacntr = 0; $pattern = '/<title>(.*?)<\\/title>/'; // grabs netblk-41-215-180-130.iconnect.zm:8080 or 66.190.144.90:27445 preg_match_all($pattern, $result, $matches); for ($i = 0; $i < count($matches[1]); $i++) { $arrtmp = explode(":", $matches[1][$yacntr]); $goodmatches[$yacntr][0] = $arrtmp[0]; $goodmatches[$yacntr][1] = $arrtmp[1]; $yacntr++; } unset($goodmatches[0]); unset($goodmatches[1]); unset($result); unset($agentstr); if (empty($goodmatches)) { // bark at them return 0; } else { return $goodmatches; // return something } }
* 需要接收的返回数据类型也是有一定的出入,所以需要此文件做个中转 */ header("Content-type: application/json"); require_once 'curl.php'; //引入curl类 $content = file_get_contents("php://input"); //读取bearychat机器人post过来的数据 $content_arr = json_decode($content); //json转对象 $info = urlencode(substr($content_arr->text, 11)); //获取传过来的内容中的text字段并截取实际内容部分,去掉触发bearychat机器人的前缀 $key = '2d6***********************c4e8ad52'; // 图灵机器人网站获取的key $request_url = "http://www.tuling123.com/openapi/api?key=" . $key . "&info=" . $info; //拼接图灵机器人所需请求url $curl = new CURL(); $request = $curl->vget($request_url); //发送请求 $request = json_decode($request, 1); //将请求转换成数组,由于图灵机器人的菜谱、列车等查询会涉及到返回list形式数据,而bearychat机器人默认不能处理,故将图灵机器人返回的list数据转化拼接到text中 if (isset($request['list'])) { //如果有list形式数据,则进行转换处理 $list = $request['list']; $text = $request['text'] . PHP_EOL; //取到text数据,开始拼接 for ($i = 1; $i <= 3; $i++) { //在list中的数据可能会有很多,为了bearychat机器人返回数据不至于过多,将最多只取前三条数据 if (!isset($list[$i])) { break; } $val = $list[$i];
} $count = count($down_image); $ces = isset($_GET['ces']) ? intval($_GET['ces']) : 0; $min = isset($_GET['min']) ? intval($_GET['min']) : 0; $max = isset($_GET['max']) ? intval($_GET['max']) : $count; if ($ces == 0) { $max = $count > 100 ? 100 : $count; } $msg = ''; if ($count > $max) { $msg = '<script>location.href = "?start=ok&ces=' . ($ces + 1) . '&min=' . ($max + 1) . '&max=' . ($max + 100 > $count ? $count : $max + 100) . '&filename=' . $filename . '&auto=' . $auto . '";</script>'; } else { $msg = '<script>location.href = "?start=ok&auto=' . ($auto + 1) . '";</script>'; } require 'curl.php'; $curl = new CURL(); for ($i = $min; $i < $max; $i++) { $v = $down_image[$i]; if (!empty($v[1])) { if (substr($v[1], 0, 1) == '/') { $dir = $v[0]; $v[1] = str_replace('item.', 'image.', $v[2] . $v[1]); } elseif (substr($v[1], 0, 7) == 'http://') { $dir = $v[0]; $v[1] = $v[1]; } elseif (substr($v[1], 0, 8) == 'https://') { $dir = $v[0]; $v[1] = $v[1]; } else { $dir = $v[0]; $v[1] = str_replace('item.', 'image.', $v[2] . '/' . $v[1]);
public function getCookie() { $curl = new CURL(); $curl->addSession('http://web1.ncaa.org/stats/StatsSrv/careersearch'); $curl->setOpt(CURLOPT_RETURNTRANSFER, 1); $curl->setOpt(CURLOPT_HEADER, 1); $page = $curl->exec(); $curl->clear(); preg_match('|Set-Cookie: (.*);|U', $page, $cookies); return $cookies[1]; }
protected function setPlayerNcaaIdsForTeam($team, $year) { $this->CI->load->library('Parse/NcaaParse'); $cookie = $this->CI->ncaaparse->getCookie(); $curl = new CURL(); $curl->addSession(sprintf('http://web1.ncaa.org/stats/StatsSrv/careerteam?academicYear=%s&coachId=-100&division=1&doWhat=display&idx=&orgId=%s&playerId=-100&sortOn=0&sportCode=MBA', $year, $team->getNcaaId())); $curl->setOpt(CURLOPT_COOKIE, $cookie); $curl->setOpt(CURLOPT_REFERER, 'http://web1.ncaa.org/stats/StatsSrv/careersearch'); $page = $curl->exec(); $curl->clear(); $this->CI->load->library('domparser'); $html = $this->CI->domparser->str_get_html($page); $players = array('' => ''); $playersArray = array(); foreach ($html->find('table.statstable', 1)->find('tr') as $key => $row) { if ($key > 2) { $id = $row->find('td', 0)->find('a', 0)->getAttribute('href'); preg_match('/[0-9]+/', $id, $match); $id = $match[0]; $player = sprintf('%s (%s / %s)', trim($row->find('td', 0)->plaintext), trim($row->find('td', 1)->plaintext), trim($row->find('td', 3)->plaintext)); $name = explode(',', trim($row->find('td', 0)->plaintext)); $playerArray = array('ncaaId' => $id, 'firstName' => trim($name[1]), 'lastName' => trim($name[0]), 'class' => trim($row->find('td', 1)->plaintext), 'position' => trim($row->find('td', 3)->plaintext)); $players[$id] = $player; $playersArray[$id] = $playerArray; } } $this->players = $players; $this->playersArray = $playersArray; return $players; }
function grabproxy($header, $agentstr) { // hidemyass.com got hax'd by hysterix! // these are the 'ghetto tables'; md5's // of an image we compare to when grabing proxies // so we can grab the port number with ease. // shit loads faster than scanning each pixel // in each image, and easier to implement. // pretty hax if you ask me, obviously they // don't want people doing this! The first rule of fight club.... // Also, if you do the md5 locally to just the file it is different from these. // I believe this is the md5 of the header as well as the image together, // don't think they are wrong when they don't compare on your system $ghetto_tables = array('2741898dc5492442a60c48fd8af5f914' => '80', '27760f111201b87996e9d5f1f55e1e2b' => '81', '8c4d39d1386fdb4dc6312a00387ae8be' => '444', '38925677a3ab9071d81b50d0e4d14ce0' => '1080', '5969ad3f3cb42fc2cfc32e667b64db4d' => '1260', '37357c1363a6edac318a513c8a16733a' => '2301', '380ac73e41c1c9f4b460b6aa74fbaea5' => '3124', '70846fe60a6915b3979033fe53f46402' => '3128', '9407ba7a72999731d6cefdc41a7522b4' => '33655', '53fc62ce0db7912b5be729849ef11dff' => '34387', '9229f0e355a3311d1f6b196ffce7cb74' => '6588', 'c1865c575ac4645f47b603deaf98ca60' => '6654', 'a580f19646451c4d832303b596fe6248' => '6666', '2980cfed592e0e31f9b0f30e24e23bf2' => '8000', '9739217797951fd6525313a762007561' => '8080', '0b269894b8fc6b74adb92840528b4e33' => '8118', '14509909876456e7539e95a9a104fcdc' => '8888', '3afb17a502f997278ec096e3347edace' => '9090', '7109cafc0782511575f4dc40e932d2e7' => '9188', '963b608d579bd4a2110e41b11eb6a12a' => '51898', '703a56c126717b1e6791915eee0ed3d8' => '65208'); // Gather an array of proxy lists (About 400 proxies in this list) $ass_hiders[0] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/1/"; $ass_hiders[1] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/2/"; $ass_hiders[2] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/3/"; $ass_hiders[3] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/4/"; $ass_hiders[4] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/5/"; $ass_hiders[5] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/6/"; $ass_hiders[6] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/7/"; $ass_hiders[7] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/8/"; $ass_hiders[8] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/9/"; $ass_hiders[9] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/10/"; $ass_hiders[10] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/11/"; $ass_hiders[11] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/12/"; $ass_hiders[12] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/13/"; $ass_hiders[13] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/14/"; $ass_hiders[14] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/15/"; $randkey = array_rand($ass_hiders); // Select a random $ass_hiders page $failed = false; //$random_hole = rand(1, count($ass_hiders)); //foreach ($ass_hiders as $ass_hider) { // UR DOIN IT WRONG $curl = new CURL(); // create the curl instance $opts = setBrowser(0, 0, $header, $agentstr); // do not set first variable to 1; we don't need infinite looping $curl->retry = MAX_RETRYS; $curl->addSession($ass_hiders[$randkey], $opts[0]); ob_start(); // this is a hack if i've ever seen one $result = $curl->exec(); // this is the site returned ob_end_clean(); // without this, php likes to output a 1 to the screen (something to do with the header info probably) // unset curl $curl->clear(); // remove the curl instance unset($curl); if (is_array($result)) { $result = $result[0] . $result[1]; } $matches = array(); $yanoob = array(); $html = str_get_html($result); $arrInput = array(); foreach ($html->find('table') as $t) { $x = 0; $matches = array(); foreach ($t->find('tr') as $rows) { foreach ($rows->find('td') as $columns) { $str = $columns->outertext; // Strip out IP's and load into array $matches /* keep the wall of shame up */ //$pattern = '|(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)|U'; //$pattern = '/^(1\d{0,2}|2(\d|[0-5]\d)?)\.(1\d{0,2}|2(\d|[0-5]\d)?) // \.(1\d{0,2}|2(\d|[0-5]\d)?)\.(1\d{0,2}|2(\d|[0-5]\d)?)$/'; //$pattern = '/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/'; $pattern = '|(\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b)|U'; if (preg_match($pattern, $str, $yatmparr)) { // we found an ip $yanoob[0] = $yatmparr[0]; // prepare the ip for the array unset($yatmparr); } foreach ($columns->find('img') as $yaimg) { $tehport = $yaimg->alt; if (strcmp($tehport, "port") == 0) { // grab the port url $portsrc = $yaimg->src; $assUrl = split_url($ass_hiders[$randkey]); $portUrl = split_url($portsrc); if (isset($portUrl['scheme'])) { // path absolute, use as-is $theport = $arrPost['url']; } else { // no host, path relative, slap this on the back of the original url; great success! $newpath = str_replace_once("/", "", $portUrl['path']); // remove the leading slash if it xists $theport = $assUrl['scheme'] . "://" . $assUrl['host'] . "/" . $newpath . '?' . $portUrl['query']; } $curl = new CURL(); // create the curl instance $opts = setBrowser(0, 0, $header, $agentstr); // do not set first variable to 1 $curl->retry = MAX_RETRYS; $curl->addSession($theport, $opts[0]); ob_start(); // this is a hack if i've ever seen one $result = $curl->exec(); // this is the png returned ob_end_clean(); // without this, php likes to output a 1 to the screen (something to do with the header info probably) // unset curl $curl->clear(); // remove the curl instance unset($curl); if (is_array($result)) { $result = $result[0] . $result[1]; } //print_r($result); // ingenuity wins out again; hysterix -1 ; hidemyass - 0 // they can slow us down but they cant stop us $portnum = retPortNum($result, $ghetto_tables); if (isset($portnum)) { // everything worked; we only want ip's with ports $yanoob[1] = $portnum; array_push($matches, $yanoob); } } } } } } $html->clear(); // if you dont include these two statements, the damn unset($html); // simple html dom becomes simple memory leaker 2.0 because unset($result); // of a f*****g "php5 circular references memory leak" - nigger t**s unset($agentstr); //Grab a random IP from array $matches $randkey = array_rand($matches, 1); $newprox = $matches[$randkey]; return $newprox; }
private static function sendRequest($url, $user, $password) { require_once __DIR__ . '/includes/php/CURL.php'; $curl = new CURL(); $curl->addOption(CURLOPT_USERPWD, $user . ':' . $password); $curl->addOption(CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-type: application/json')); $curl->addOption(CURLOPT_HEADER, true); $data = $curl->get($url); if ($curl->getRequestInfo('http_code') != 200) { return false; } else { return $data; } }