public function GetPage($link, $cookie = 0, $post = 0, $referer = 0, $auth = 0, $XMLRequest = 0) { if (!$referer && !empty($GLOBALS['Referer'])) { $referer = $GLOBALS['Referer']; } $cURL = $GLOBALS['options']['use_curl'] && extension_loaded('curl') && function_exists('curl_init') && function_exists('curl_exec') ? true : false; $Url = parse_url(trim($link)); if (strtolower($Url['scheme']) == 'https') { $chttps = false; if ($cURL) { $cV = curl_version(); if (in_array('https', $cV['protocols'], true)) { $chttps = true; } } if (!extension_loaded('openssl') && !$chttps) { html_error('You need to install/enable PHP\'s OpenSSL extension to support HTTPS connections.'); } elseif (!$chttps) { $cURL = false; } } if ($cURL) { if ($XMLRequest) { $referer .= "\r\nX-Requested-With: XMLHttpRequest"; } $page = cURL($link, $cookie, $post, $referer, $auth); } else { global $pauth; $page = geturl($Url['host'], defport($Url), $Url['path'] . (!empty($Url['query']) ? '?' . $Url['query'] : ''), $referer, $cookie, $post, 0, !empty($_GET['proxy']) ? $_GET['proxy'] : '', $pauth, $auth, $Url['scheme'], 0, $XMLRequest); is_page($page); } return $page; }
function array_sha($findgit, $all = false, $page = 1, $per_page = 100, $array = array()) { $url = "https://api.github.com/repos/" . $findgit . "/commits?page=" . $page . "&per_page=" . $per_page; $json = cURL($url); if (isset($json['message'])) { return $json; } foreach ($json as $key => $value) { $file = ""; if (isset($value['sha'])) { if (!$all) { $url = "https://api.github.com/repos/" . $findgit . "/commits/" . $value['sha']; $files = cURL($url); if (isset($files['files'])) { foreach ($files['files'] as $val) { $file .= $val['filename'] . "<br>"; } } } $array[] = array('sha' => $value['sha'], 'name' => $value['commit']['committer']['name'], 'date' => $value['commit']['committer']['date'], 'message' => $value['commit']['message'], 'files' => $file); } } if (++$key == $per_page && $all) { $array = array_sha($findgit, $all, ++$page, $per_page, $array); } return $array; }
function getChapter($url, $debug) { $content = extract_id(cURL($url), "storytext", $debug); $content = str_replace(array("‘", "’", "“", "”", "–", "—", "…"), array("'", "'", '"', '"', '-', '--', '...'), $content); $content = str_replace(array(chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(133)), array("'", "'", '"', '"', '-', '--', '...'), $content); return $content; }
public function GetPage($link, $cookie = 0, $post = 0, $referer = 0, $auth = 0, $XMLRequest = 0) { global $options; if (!$referer) { global $Referer; $referer = $Referer; } $cURL = $options['use_curl'] && extension_loaded('curl') && function_exists('curl_init') && function_exists('curl_exec') ? true : false; $Url = parse_url(trim($link)); if ($Url['scheme'] == 'https') { $chttps = false; if ($cURL) { $cV = curl_version(); if (in_array('https', $cV['protocols'], true)) { $chttps = true; } } if (!extension_loaded('openssl') && !$chttps) { html_error('This server doesn\'t support https connections.'); } elseif (!$chttps) { $cURL = false; } } if ($cURL) { if ($XMLRequest) { $referer .= "\r\nX-Requested-With: XMLHttpRequest"; } $page = cURL($link, $cookie, $post, $referer, $auth); } else { global $pauth; $page = geturl($Url['host'], defport($Url), $Url['path'] . (!empty($Url['query']) ? '?' . $Url['query'] : ''), $referer, $cookie, $post, 0, !empty($_GET['proxy']) ? $_GET['proxy'] : '', $pauth, $auth, $Url['scheme'], 0, $XMLRequest); is_page($page); } return $page; }
function getHPFanficArchiveInfo($url) { $urlParts = parse_url($url); parse_str($urlParts['query'], $query); if (isset($query['sid'])) { $storyId = $query['sid']; if (is_numeric($storyId)) { $url = "{$urlParts['scheme']}://{$urlParts['host']}/stories/viewstory.php?sid={$storyId}"; $response = cURL($url); $html = new HTML5(); $html = $html->loadHTML($response); $story = new Story(); $story->id = $storyId; $story->url = $url; $title = qp($html, '#pagetitle')->find('a[href^="viewstory"]')->first()->text(); if (empty($title)) { throw new FicSaveException("Could not retrieve title for story at {$url}."); } else { $story->title = $title; } $author = qp($html, '#pagetitle')->find('a[href^="viewuser"]')->first()->text(); if (empty($author)) { throw new FicSaveException("Could not retrieve author for story at {$url}."); } else { $story->author = $author; } $description = qp($html, '#mainpage')->find('.block')->get(1); if ($description == NULL) { throw new FicSaveException("Could not retrieve description for story at {$url}."); } else { $story->description = stripAttributes(preg_replace('/<a(.*?)>(.*?)<\\/a>/', '\\2', trim(qp($description)->find('.content')->first()->innerHTML()))); } $chaptersBlock = qp($html, '#mainpage')->find('.block')->get(3); if ($chaptersBlock == NULL) { throw new FicSaveException("Could not get number of chapters for story at {$url}."); } else { $chapterLinks = qp($chaptersBlock)->find('a[href^="viewstory"]'); $numChapters = $chapterLinks->count(); if ($numChapters > 0) { $story->chapters = $numChapters; $story->metadata = array(); foreach ($chapterLinks as $chapterLink) { $story->metadata[] = $chapterLink->text(); } } else { throw new FicSaveException("Could not get number of chapters for story at {$url}."); } } return $story; } else { throw new FicSaveException("URL has an invalid story ID: {$storyId}."); } } else { throw new FicSaveException("URL is missing story ID."); } }
function getFanfictionNetInfo($url) { $urlParts = parse_url($url); $pathParts = explode('/', $urlParts['path']); if (isset($pathParts[2])) { $storyId = $pathParts[2]; if (is_numeric($storyId)) { $response = cURL($url); $html = new HTML5(); $html = $html->loadHTML($response); $story = new Story(); $story->id = $storyId; $urlParts = parse_url($url); $story->url = "{$urlParts['scheme']}://{$urlParts['host']}/s/{$storyId}"; $title = qp($html, '#profile_top')->find('b')->first()->text(); if (empty($title)) { throw new FicSaveException("Could not retrieve title for story at {$url}."); } else { $story->title = $title; } $author = qp($html, '#profile_top')->find('a')->first()->text(); if (empty($author)) { throw new FicSaveException("Could not retrieve author for story at {$url}."); } else { $story->author = $author; } $description = qp($html, '#profile_top')->find('div')->get(2); if ($description == NULL) { throw new FicSaveException("Could not retrieve description for story at {$url}."); } else { $story->description = stripAttributes(preg_replace('/<a(.*?)>(.*?)<\\/a>/', '\\2', trim(qp($description)->html() . qp($description)->next()->html()))); } $numChapters = qp($html, '#chap_select')->find('option')->count() / 2; // value is always doubled for some reason $story->chapters = $numChapters == 0 ? 1 : $numChapters; $coverImageUrl = qp($html, '#profile_top')->find('img')->first()->attr('src'); if ($coverImageUrl != NULL) { $coverImageUrlParts = parse_url($coverImageUrl); if (!isset($coverImageUrlParts['scheme']) && substr($coverImageUrl, 0, 2) == '//') { $coverImageUrl = $urlParts['scheme'] . ":" . $coverImageUrl; } $coverImageUrl = str_replace('/75/', '/180/', $coverImageUrl); $story->coverImageUrl = $coverImageUrl; } return $story; } else { throw new FicSaveException("URL has an invalid story ID: {$storyId}."); } } else { throw new FicSaveException("URL is missing story ID."); } }
function getChapter($url, $debug, $cookies, $uniqid) { $dom = new DOMDocument(); $dom->loadHTML(cURL($url, $debug, $cookies, $uniqid)); $xpath = new DOMXPath($dom); $xpath_content = $xpath->query("//tr[4]/td"); $content = ""; foreach ($xpath_content as $node_content) { $content = $node_content->ownerDocument->saveHTML($node_content); } $content = str_replace(array("‘", "’", "“", "”", "–", "—", "…"), array("'", "'", '"', '"', '-', '--', '...'), $content); $content = str_replace(array(chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(133)), array("'", "'", '"', '"', '-', '--', '...'), $content); return $content; }
function getAsianFanficsInfo($url) { $urlParts = parse_url($url); $pathParts = explode('/', $urlParts['path']); if (isset($pathParts[3])) { $storyId = $pathParts[3]; if (is_numeric($storyId)) { $url = "{$urlParts['scheme']}://{$urlParts['host']}/story/view/{$storyId}"; $response = cURL($url); $html = new HTML5(); $html = $html->loadHTML($response); $story = new Story(); $story->id = $storyId; $story->url = $url; $title = trim(qp($html, 'h1.title')->first()->text()); if (empty($title)) { throw new FicSaveException("Could not retrieve title for story at {$url}."); } else { $story->title = $title; } $author = qp(qp($html, 'span.text--info')->get(0))->next()->text(); if (empty($author)) { throw new FicSaveException("Could not retrieve author for story at {$url}."); } else { $story->author = $author; } $description = qp($html, '#bodyText')->find('h2')->first()->next(); if ($description == NULL) { throw new FicSaveException("Could not retrieve description for story at {$url}."); } else { $story->description = stripAttributes(trim($description->innerHTML())); } $story->chapters = qp($html, 'select[name="chapterNav"]')->find('option')->count() - 1; return $story; } else { throw new FicSaveException("URL has an invalid story ID: {$storyId}."); } } else { throw new FicSaveException("URL is missing story ID."); } }
function getAdultFanfictionOrgInfo($url) { $urlParts = parse_url($url); parse_str($urlParts['query'], $query); if (isset($query['no'])) { $storyId = $query['no']; if (is_numeric($storyId)) { $response = cURL($url); $html = new HTML5(); $html = $html->loadHTML($response); $story = new Story(); $story->id = $storyId; $urlParts = parse_url($url); $story->url = "{$urlParts['scheme']}://{$urlParts['host']}/story.php?no={$storyId}"; $title = trim(str_replace('Story:', '', qp($html, 'title')->text())); if (empty($title)) { throw new FicSaveException("Could not retrieve title for story at {$url}."); } else { $story->title = $title; } $author = trim(qp(qp($html, 'tr.catdis')->find('td')->get(1))->find('a')->text()); if (empty($author)) { throw new FicSaveException("Could not retrieve author for story at {$url}."); } else { $story->author = $author; } $numChapters = qp($html, 'select[name=chapnav]')->find('option')->count(); if ($numChapters > 0) { $story->chapters = $numChapters; } else { throw new FicSaveException("Could not get number of chapters for story at {$url}."); } return $story; } else { throw new FicSaveException("URL has an invalid story ID: {$storyId}."); } } else { throw new FicSaveException("URL is missing story ID."); } }
function facebookConnect($EMAIL, $PASSWORD) { $cookie = ""; //incorrect username and password here, we just want cookie data. $a = cURL("https://login.facebook.com/login.php?login_attempt=1", true, null, "email=steve@apple.com&pass=ipod"); preg_match('%Set-Cookie: ([^;]+);%', $a, $b); if (count($b) == 0) { echo "Cookie phase one failed."; die; } $c = cURL("https://login.facebook.com/login.php?login_attempt=1", true, $b[1], "email={$EMAIL}&pass={$PASSWORD}"); $fail = strpos($c, "Your account has a high number of invalid login attempts."); if ($fail !== false) { echo "Failed due to password abuse."; die; } preg_match_all('%Set-Cookie: ([^;]+);%', $c, $d); for ($i = 0; $i < count($d[0]); $i++) { $cookie .= $d[1][$i] . ";"; } return $cookie; }
private function Login() { if (!empty($_REQUEST['pA_encrypted']) && !empty($_REQUEST['premium_user']) && !empty($_REQUEST['premium_pass'])) { $_REQUEST['premium_user'] = decrypt(urldecode($_REQUEST['premium_user'])); $_REQUEST['premium_pass'] = decrypt(urldecode($_REQUEST['premium_pass'])); unset($_REQUEST['pA_encrypted']); } $pA = empty($_REQUEST['premium_user']) || empty($_REQUEST['premium_pass']) ? false : true; $user = $pA ? $_REQUEST['premium_user'] : $GLOBALS['premium_acc']['rapidgator_net']['user']; $pass = $pA ? $_REQUEST['premium_pass'] : $GLOBALS['premium_acc']['rapidgator_net']['pass']; if (empty($user) || empty($pass)) { html_error('Login Failed: User or Password is empty. Please check login data.', 0); } $this->cookie = array('lang' => 'en'); // Account is always showed as free if it comes from a file, as i don't send file's link as referer, lets reset the cookies. $post = array(); $post['LoginForm%5Bemail%5D'] = urlencode($user); $post['LoginForm%5Bpassword%5D'] = urlencode($pass); $post['LoginForm%5BrememberMe%5D'] = '1'; if (!empty($_POST['step']) && $_POST['step'] == '1') { if (empty($_POST['captcha'])) { html_error('You didn\'t enter the image verification code.'); } $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie']))); $post['LoginForm%5BverifyCode%5D'] = urlencode($_POST['captcha']); } $purl = 'http://rapidgator.net/'; // There are more of those redirects at login $rdc = 0; $page = false; // False value for starting the loop. $redir = $purl . 'auth/login'; $this->referer = !empty($GLOBALS['Referer']) && $GLOBALS['Referer'] != $this->link ? $GLOBALS['Referer'] : $purl; while (($redir = $this->ChkRGRedirs($page, $redir, '(?:/auth/login|/site/ChangeLocation/key/)')) && $rdc < 15) { $page = cURL($redir, $this->cookie, $post, $this->referer); $this->cookie = GetCookiesArr($page, $this->cookie); $this->referer = $redir; $rdc++; } is_present($page, 'Error e-mail or password.', 'Login Failed: Email/Password incorrect.'); is_present($page, 'E-mail is not a valid email address.', 'Login Failed: Login isn\'t an email address.'); is_present($page, 'We discovered that you try to access your account from unusual location.', 'Login Failed: Login Blocked By IP, Check Account Email And Follow The Steps To Add IP to Whitelist.'); if (stripos($page, 'The code from a picture does not coincide') !== false) { if (!empty($_POST['step']) && $_POST['step'] == '1') { html_error('Login Failed: Incorrect CAPTCHA response.'); } if (!preg_match('@(https?://(?:[^\\./\\r\\n\'\\"\\t\\:]+\\.)?rapidgator\\.net(?:\\:\\d+)?)?/auth/captcha/\\w+/\\w+@i', $page, $imgurl)) { html_error('Error: CAPTCHA not found.'); } $imgurl = empty($imgurl[1]) ? 'http://rapidgator.net' . $imgurl[0] : $imgurl[0]; //Download captcha img. $capt_page = cURL($imgurl, $this->cookie); $capt_img = substr($capt_page, strpos($capt_page, "\r\n\r\n") + 4); $imgfile = DOWNLOAD_DIR . 'rapidgator_captcha.png'; if (file_exists($imgfile)) { unlink($imgfile); } if (!write_file($imgfile, $capt_img)) { html_error('Error getting CAPTCHA image.'); } unset($capt_page, $capt_img); $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie))); $data['step'] = '1'; $data['premium_acc'] = 'on'; // I should add 'premium_acc' to DefaultParamArr() if ($pA) { $data['pA_encrypted'] = 'true'; $data['premium_user'] = urlencode(encrypt($user)); // encrypt() will keep this safe. $data['premium_pass'] = urlencode(encrypt($pass)); // And this too. } $this->EnterCaptcha($imgfile . '?' . time(), $data); exit; } //is_present($page, 'The code from a picture does not coincide', 'Login Failed: Captcha... (T8: I will add it later)'); if (empty($this->cookie['user__'])) { html_error("Login Error: Cannot find 'user__' cookie."); } $this->cookie['lang'] = 'en'; $page = cURL($purl, $this->cookie, 0, $purl . 'auth/login'); is_present($page, '>Free</a>', 'Account isn\'t premium'); $this->PremiumDL(); }
function getStorage($storageNum) { $url = "http://www.blood.org.tw/Internet/main/index.aspx"; $response = cURL($url, ''); $html = str_get_html($response); $res = $html->find('div[id=tool_blood_cube]', 0)->find('div[class=Storage]'); $data = array(); foreach ($res as $key => $value) { if ($storageNum == $key || $storageNum == -1) { $row = array(); $row['region'] = $value->find('div[id=StorageHeader]', 0)->plaintext; $temp = $value->find('div', 1)->find('div'); foreach ($temp as $key1 => $blood) { $id = $blood->getAttribute('id'); $type = $blood->find('img', 0)->getAttribute('alt'); switch ($type) { case '庫存量7日以上': $row[$id] = 3; break; case '庫存量4到7日': $row[$id] = 2; break; case '庫存量4日以下': $row[$id] = 1; break; default: $row[$id] = 0; break; } } array_push($data, $row); } } // echo "<pre>"; // print_r($data); // echo "</pre>"; // // echo "$res"; return $data; }
//storageA //storageB //storageAB //storageO set_time_limit(0); header("Content-Type:text/html; charset=utf-8"); require_once 'simple_html_dom.php'; $link = mysqli_connect('localhost', 'client', '1qaz2wsx', 'blood'); mysqli_query($link, "SET NAMES 'UTF8'"); $url = "http://www.blood.org.tw/Internet/main/map.aspx"; $length = 5; $data = array(); for ($i = 1; $i < $length; $i++) { $row = array(); $response = cURL($url . '?spotID=' . $i, ''); $html = str_get_html($response); $res = $html->find('td[id=date_place]', 0)->plaintext; if (trim($res) != "") { $row['name'] = trim($res); $res = $html->find('table[id=map_ifrom]', 0)->find('tr'); foreach ($res as $key => $value) { $text = $value->find('td', 1)->plaintext; array_push($row, trim($text)); } $text = explode('(', trim($row['name'])); $row['name'] = $text[0]; if (isset($text[1])) { $row[3] .= '<br>' . explode(')', $text[1])[0]; } $text = explode('(', trim($row[0]));
/** * Retrieve even more specific Item-Data and store them. See above, "saveItems" * @param $db - Database */ function saveItemData($db) { global $apiKey; $arr = json_decode(cURL("https://global.api.pvp.net/api/lol/static-data/euw/v1.2/item?itemListData=from,into,tags&api_key=" . $apiKey), true); foreach ($arr["data"] as $val) { if (!empty($val["tags"])) { prettyPrint($val["tags"]); foreach ($val["tags"] as $tag) { $stmt = $db->mysqli->prepare("INSERT INTO `ItemTags` (`ItemID`, `Tag`) VALUES (?, ?)"); $stmt->bind_param("is", $val["id"], $tag); $stmt->execute(); $stmt->close(); } } if (!empty($val["from"])) { foreach ($val["from"] as $from) { $stmt = $db->mysqli->prepare("INSERT INTO `ItemBuildsFrom` (`ItemID`, `BuildsFromID`) VALUES (?, ?)"); $stmt->bind_param("is", $val["id"], $from); $stmt->execute(); $stmt->close(); } } if (!empty($val["into"])) { foreach ($val["into"] as $into) { $stmt = $db->mysqli->prepare("INSERT INTO `ItemBuildsInto` (`ItemID`, `BuildsIntoID`) VALUES (?, ?)"); $stmt->bind_param("is", $val["id"], $into); $stmt->execute(); $stmt->close(); } } } }
$story["debug"] = false; $cookies = ""; $parse = parse_url($story["story_url"]); $domain = $parse["host"]; if (strpos($domain, "fanfiction.net") !== false || strpos($domain, "fictionpress.com") !== false) { include_once "include/fanfiction_net.php"; } else { if (strpos($domain, "adult-fanfiction.org") !== false) { $host = explode('.', $parse['host']); $subdomain = $host[0]; $cookies = "HasVisited=bypass page next time; path=/; domain={$subdomain}.adult-fanfiction.org"; include_once "include/adultfanfiction_org.php"; } } $dom = new DOMDocument(); $dom->loadHTML(cURL($story["story_url"], $story["debug"], $cookies, $uniqid)); $xpath = new DOMXPath($dom); try { $story = getStoryAttributes($xpath, $story); } catch (WrongFormatException $ex) { error_log("" . $ex); echo "error"; exit(0); } $numChapter = $story["numChapter"]; // ========== CREATE EBOOK ========== // $content_start = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\n" . " \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n" . "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" . "<head>" . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n" . "<title>" . $story["title"] . "</title>\n" . "<style>.coverPage { text-align: center; height: 100%; width: 100%; }</style>\n" . "</head>\n" . "<body>\n"; $bookEnd = "</body>\n</html>\n"; if ($format == "pdf") { require_once "pdf/tcpdf.php"; $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// Ping api $page = geturl('api.filecloud.io', 80, '/api-ping.api'); is_page($page); is_notpresent($page, '"message":"pong"', 'Error: filecloud.io api is down?.'); // Login if (!empty($_REQUEST['up_uselogin']) && $_REQUEST['up_uselogin'] == 'yes' && !empty($_REQUEST['up_login']) && !empty($_REQUEST['up_pass'])) { echo "\n<div id='login' width='100%' align='center'>Getting Apikey for filecloud.io</div>\n"; $post = array(); $post['username'] = urlencode($_REQUEST['up_login']); $post['password'] = urlencode($_REQUEST['up_pass']); if (!$usecurl) { $page = geturl('secure.filecloud.io', 0, '/api-fetch_apikey.api', 'https://secure.filecloud.io/api-fetch_apikey.api', 0, $post, 0, 0, 0, 0, 'https'); // Port is overridden to 443 . is_page($page); } else { $page = cURL('https://secure.filecloud.io/api-fetch_apikey.api', $post); } is_present($page, '"status":"error"', 'Login Failed: "' . str_replace('\\', '', cut_str($page, '"message":"', '"')) . '"'); is_notpresent($page, '"akey":"', "Login Failed: Akey not found."); $_REQUEST['up_apikey'] = cut_str($page, '"akey":"', '"'); $uselogin = true; } else { if (empty($_REQUEST['up_apikey'])) { $login = false; echo "<b><center>Neither Apikey nor Login were found or are empty, using non member upload.</center></b>\n"; } } if ($login && !$uselogin) { // Check Apikey... $_REQUEST['up_apikey'] = trim($_REQUEST['up_apikey']); echo "<script type='text/javascript'>document.getElementById('login').style.display='none';</script>\n<div id='apikey' width='100%' align='center'>Checking Apikey</div>\n";
* @copyright Kevin Hinds @ KevinHinds.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require 'config.php'; echo cURL("https://{$DarkSKYURI}/forecast/{$APIKEY}/{$latitude},{$longitude}"); /** * get the response from the API to send to the JS * @param strong $URL * @return string, JSON encoded webservice response */ function cURL($URL) { // is cURL installed yet? if (!function_exists('curl_init')) { die('Sorry cURL is not installed!'); } // download response from URL $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $URL); curl_setopt($ch, CURLOPT_HEADER, 0);
function doApiReq($atrr) { global $options, $T8; $domain = 'g.api.mega.co.nz'; //$domain = 'eu.api.mega.co.nz'; if (!function_exists('json_encode')) { html_error('Error: Please enable JSON in php.'); } $cURL = $options['use_curl'] && extension_loaded('curl') && function_exists('curl_init') && function_exists('curl_exec') ? true : false; $chttps = false; if ($cURL) { $cV = curl_version(); if (in_array('https', $cV['protocols'], true)) { $chttps = true; } } if (!extension_loaded('openssl') && !$chttps) { html_error('You need to install/enable PHP\'s OpenSSL extension to support HTTPS connections.'); } elseif (!$chttps) { $cURL = false; } $sid = !empty($T8['sid']) ? '&sid=' . $T8['sid'] : ''; $post = json_encode($atrr); $referer = "https://mega.co.nz/\r\nContent-Type: application/json"; if ($cURL) { $page = cURL("https://{$domain}/cs?id=" . $T8['seqno']++ . $sid, 0, "[{$post}]", $referer); } else { global $pauth; $page = geturl($domain, 443, '/cs?id=' . $T8['seqno']++ . $sid, $referer, 0, "[{$post}]", 0, 0, 0, 0, 'https'); is_page($page); } list($header, $page) = array_map('trim', explode("\r\n\r\n", $page, 2)); if (is_numeric($page)) { return array((int) $page); } if (in_array((int) substr($header, 9, 3), array(500, 503))) { return array(-3); } // 500 Server Too Busy return Get_Reply($page); }
$url = parse_url($up_url); $upfiles = upfile($url['host'], 80, $url['path'] . ($url['query'] ? '?' . $url['query'] : ''), '', '', $post, $lfile, $lname, $video ? 'video_file' : 'file', '', $_GET['proxy'], $pauth); // Upload Finished echo "<script type='text/javascript'>document.getElementById('progressblock').style.display='none';</script>\n"; is_page($upfiles); $upres = Get_Reply($upfiles); if (!empty($upres['error'])) { html_error("Upload Error: [{$upres['error']['error_code']}] {$upres['error']['error_msg']}"); } if (!$video) { sleep(1); // Let's wait another second :D $data = array('api_id' => $app['id'], 'method' => 'audio.save', 'audio' => $upres['audio'], 'hash' => $upres['hash'], 'server' => $upres['server']); $req = SigAndReq($data, '/method/' . $data['method'] . '?'); if ($usecurl) { $page = cURL('https://api.vk.com' . $req); } else { $page = geturl('api.vk.com', 0, $req, 0, 0, array('hash' => $upres['hash']), 0, $_GET['proxy'], $pauth, 0, 'https'); // Port is overridden to 443 is_page($page); } $rply = Get_Reply($page); } if (!empty($rply['error'])) { if (is_array($rply['error'])) { html_error("audio.save Error: [{$rply['error']['error_code']}] {$rply['error']['error_msg']}"); } else { html_error('Save Error: ' . $rply['error']); } } if ($video && !empty($upsrv['response']['vid'])) {
function mf_apireq($action, $post = array()) { if (!function_exists('json_encode')) { html_error('Error: Please enable JSON in PHP.'); } if (!is_array($post)) { html_error('mf_apireq: Parameter 2 must be passed as an array.'); } $post['response_format'] = 'json'; // Get API replies in json if (in_array($action, array('user/get_session_token', 'upload/poll_upload'))) { unset($post['session_token']); } else { if (empty($post['session_token']) && !empty($GLOBALS['app']['session_token'])) { $post['session_token'] = $GLOBALS['app']['session_token']; } } $post = array_map('urlencode', array_filter($post)); $path = "api/{$GLOBALS['app']['api_version']}/{$action}.php"; if ($GLOBALS['cURL']) { $page = cURL($GLOBALS['referer'] . $path, 0, $post, $GLOBALS['referer']); } else { $page = geturl($GLOBALS['domain'], 443, "/{$path}", $GLOBALS['referer'], 0, $post, 0, 0, 0, 0, 'https'); // geturl doesn't support https proxy is_page($page); } $status = (int) substr($page, 9, 3); if ($status >= 500) { return array('result' => 'Error', 'error' => $status, 'message' => "mf_apireq: HTTP Error {$status}."); } $json = Get_Reply($page); if (count($json) == 1 && !empty($json['response'])) { $json = $json['response']; } return $json; }
echo "<p style='color:red;text-align:center;font-weight:bold;'>This plugin is not longer supported, use it while it still works.</p>\n"; $not_done = false; // Login echo "<table style='width:600px;margin:auto;'>\n<tr><td align='center'>\n<div id='login' width='100%' align='center'>Validating login</div>\n"; if (empty($_REQUEST['up_login']) || empty($_REQUEST['up_pass'])) { html_error("Login or pass empty.", 0); } $post = array(); $post['Email'] = urlencode($_REQUEST['up_login']); $post['Passwd'] = urlencode($_REQUEST['up_pass']); $post['service'] = 'youtube'; if (!$usecurl) { $page = geturl("www.google.com", 80, '/accounts/ClientLogin', "https://www.google.com/accounts/ClientLogin", 0, $post, 0, 0, 0, 0, 'https'); is_page($page); } else { $page = cURL("https://www.google.com/accounts/ClientLogin", 0, $post); } is_present($page, "Error=BadAuthentication", "Login Failed: The login/password entered are incorrect."); is_present($page, "Error=NotVerified", "Login Failed: The account has not been verified."); is_present($page, "Error=TermsNotAgreed", "Login Failed: The account has not agreed to terms."); is_present($page, "Error=CaptchaRequired", "Login Failed: Need CAPTCHA. (Not supported yet)... Or check you login and try again."); is_present($page, "Error=Unknown", "Login Failed."); is_present($page, "Error=AccountDeleted", "Login Failed: The user account has been deleted."); is_present($page, "Error=AccountDisabled", "Login Failed: The user account has been disabled."); is_present($page, "Error=ServiceDisabled", "Login Failed: The user's access to the specified service has been disabled."); is_present($page, "Error=ServiceUnavailable", "Login Failed: Service is not available; try again later."); if (!preg_match('@Auth=([^\\r|\\n]+)@i', $page, $auth)) { html_error("Login Failed: Auth token not found.", 0); } // Preparing upload echo "<script type='text/javascript'>document.getElementById('login').style.display='none';</script>\n<div id='info' width='100%' align='center'>Preparing upload</div>\n";
<tr> <td>Examples:</td> <td>41</td> <td>sd44sgh</td> </tr> </table> </form> <?php // available numerb alias API call if (isset($_POST['Send6'])) { $countryCode = $_POST['countryCode']; $UID = $_POST['UID']; $jsonString = json_encode(array("jsonrpc" => "2.0", "method" => "alias.availableNumberAlias", "params" => array("countryCode" => $countryCode, "UID" => "{$UID}"), "id" => 6)); echo prettyPrint($jsonString, "API Request : "); cURL($jsonString); } function cURL($jsonString) { $protocol = empty($_SERVER['HTTPS']) ? 'http://' : 'https://'; $options = array("url" => $protocol . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/../public/index.php"); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $options["url"]); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($jsonString))); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonString); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $result = curl_exec($ch); curl_close($ch);
} $up_url = $form_url[1] . "{$uuid}&folder_id=0"; // Uploading echo "<script type='text/javascript'>document.getElementById('info').style.display='none';</script>\n"; $url = parse_url($up_url); $upfiles = upfile($url['host'], 80, $url['path'] . (!empty($url['query']) ? '?' . $url['query'] : ''), $referer, $cookie, array(), $lfile, $lname, 'file', '', $_GET['proxy'], $pauth); // Upload Finished echo "<script type='text/javascript'>document.getElementById('progressblock').style.display='none';</script>"; is_page($upfiles); //Redirects $rdc = 0; $page = false; // False value for starting the loop. $redir = $prog_url[1] . "&data%5B0%5D%5Buuid%5D={$uuid}&data%5B0%5D%5Bstart_time%5D={$starttime}"; while (($redir = ChkRGRedirs($page, $redir)) && $rdc < 15) { $page = cURL($redir, $cookie, 0, $referer); $cookie = GetCookiesArr($page, $cookie); $referer = $redir; $rdc++; } $body = substr($page, strpos($page, "\r\n\r\n") + 4); if (!preg_match_all('@"([^\\"]*)":"([^\\"]*)"@i', $body, $resp)) { html_error("Unknown reply from server."); } $resp = array_combine($resp[1], array_map('stripcslashes', $resp[2])); if (!empty($resp['download_url'])) { $download_link = $resp['download_url']; if (!empty($resp['remove_url'])) { $delete_link = $resp['remove_url']; } } else {
function vk_GetPage($link, $cookie = 0, $post = 0, $referer = 0, $auth = 0, $XMLRequest = 0) { if (!$referer && !empty($GLOBALS['Referer'])) { $referer = $GLOBALS['Referer']; } if ($GLOBALS['usecurl']) { if ($XMLRequest) { $referer .= "\r\nX-Requested-With: XMLHttpRequest"; } $page = cURL($link, $cookie, $post, $referer, $auth); } else { global $pauth; $Url = parse_url($link); $page = geturl($Url['host'], defport($Url), $Url['path'] . (!empty($Url['query']) ? '?' . $Url['query'] : ''), $referer, $cookie, $post, 0, !empty($_GET['proxy']) ? $_GET['proxy'] : '', $pauth, $auth, $Url['scheme'], 0, $XMLRequest); is_page($page); } return $page; }
$ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, $header); curl_setopt($ch, CURLOPT_NOBODY, $header); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_COOKIE, $cookie); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); if ($p) { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $p); } $result = curl_exec($ch); echo $result; if ($result) { return $result; } else { return curl_error($ch); } curl_close($ch); } $a = cURL("https://login.facebook.com/login.php?login_attempt=1", true, null, "email={$EMAIL}&pass={$PASSWORD}"); preg_match('%Set-Cookie: ([^;]+);%', $a, $b); $c = cURL("https://login.facebook.com/login.php?login_attempt=1", true, $b[1], "email={$EMAIL}&pass={$PASSWORD}"); preg_match_all('%Set-Cookie: ([^;]+);%', $c, $d); for ($i = 0; $i < count($d[0]); $i++) { $cookie .= $d[1][$i] . ";"; }
function getMarket() { $recent = "http://steamcommunity.com/market/recentcompleted?currency=usd"; $json = cURL($recent); $json = json_decode($json, true); $results = $json["results_html"]; $results = stripcslashes($results); return $results; }
$stmt3->execute(); $res = $stmt3->get_result(); $ret = array(); while ($row = $res->fetch_assoc()) { array_push($ret, $row); } $stmt3->free_result(); $stmt3->close(); $itemset = ItemSet::newSet(collapseResultArray($ret)[$_GET["copy"]]); } //HTML Template for the user-specific part on the website $userTemplate = new Template("www/templates/loggedin_template.html"); //Give the template the possibility to use the UserAuthentification class. $userTemplate->setVar("UserAuthentification", $userAuth); //Array mapping a champion name to its icon. Array ( ["ChampionName"] => "Icon", ["ChampionName2"] => "Icon2" ) $champJson = cURL("https://global.api.pvp.net/api/lol/static-data/euw/v1.2/champion?champData=image&api_key=" . $apiKey); $championData = parseChampJSON($champJson, array("Champion" => new ArrayObject(array("img" => "www/any.png", "name" => "Any Champion", "key" => "Champion"), ArrayObject::ARRAY_AS_PROPS))); //$spellData = parseSpellJSON(cURL("https://global.api.pvp.net/api/lol/static-data/euw/v1.2/summoner-spell?spellData=image,key&api_key=" . $apiKey)); //Get all those items... $itemdata = recursiveArrayObject(collapseResultArray2($database->query("SELECT i.ID AS ItemID, i.Gold, i.Name AS ItemName, i.Description, ibi.BuildsIntoID, ibf.BuildsFromID, it.Tag FROM `Items` i LEFT JOIN `ItemBuildsFrom` ibf ON i.ID = ibf.ItemID LEFT JOIN `ItemBuildsInto` ibi ON i.ID = ibi.ItemID LEFT JOIN `ItemTags` it ON i.ID = it.ItemID"), true, true, true), ArrayObject::ARRAY_AS_PROPS); $headerTemplate = new Template("www/templates/header_template.html"); $headerTemplate->setVar("UserTemplate", $userTemplate); $headerTemplate->setVar("buttons", array(new ArrayObject(array("name" => "Home", "href" => "index.php"), ArrayObject::ARRAY_AS_PROPS), new ArrayObject(array("name" => "My Sets", "href" => "mysets.php"), ArrayObject::ARRAY_AS_PROPS))); //And then, printerino! $csTemplate = new Template("www/templates/createset_template.html"); $csTemplate->setVar("ChampionData", $championData); $csTemplate->setVar("ItemSet", $itemset); //$csTemplate->setVar("SpellData", $spellData); $csTemplate->setVar("Items", $itemdata); $csTemplate->setVar("i", 1); $csTemplate->setVar("TypusMaximusWaddafakius", $type);
//echo 'Total articles in first fetch ' . count($arrArticles); while ($responseJson['next_page']) { //echo 'There is next page '.$responseJson['next_page']; $page = $page + 1; $responseJson = cURL("https://trustpilot.zendesk.com/api/v2/help_center/articles.json?per_page=100&draft=false&page=" . $page); //var_dump($responseJson); //echo 'Total articles in page='. $page .' fetch ' . count($responseJson['articles']); $arrArticles = array_merge($arrArticles, $responseJson['articles']); } echo 'Total articles after merges ' . count($arrArticles); foreach ($arrArticles as $article) { $articleID = $article['id']; $articleName = $article['title']; $gelements = []; $gtab = []; $translationJson = cURL("https://trustpilot.zendesk.com/api/v2/help_center/articles/" . $article['id'] . "/translations.json?locale=en-us,da,de,es,fr,it,nl,sv"); //echo '*****************' . $articleID; //var_dump($translationJson['translations']); foreach ($translationJson['translations'] as $translation) { $sectionID = $translation['id']; $locale = $translation['locale']; $lastUpdate = $translation['updated_at']; $sectionTitle = $translation['title']; $sectionContent = $translation['body']; if (strlen(get_string_between($sectionContent, '<script>', '</script>')) > 0) { $scriptBody = '<script>' . get_string_between($sectionContent, '<script>', '</script>') . '</script>'; } else { $scriptBody = ''; } $sectionContent = replace_between($sectionContent, '<script>', '</script>', ''); //echo "--> Article " . $articleID . " being imported now ";
} else { if ($key == 'full_name') { $html .= "<tr><td><a href='#' id='github_curl' title='" . $value . "'>" . $value . "</a></td>"; } if ($key == 'created_at') { $html .= "<td>" . $value . "</td></tr>"; } } } return $html; } // https://api.github.com/repos/tan-tan-kanarek/github-php-client/commits?page=1&per_page=100&path=README.md if ($findgit !== "" && $sha !== "") { $html .= "<br>Проект: <strong>" . $findgit . "</strong><br>"; $url = "https://api.github.com/repos/" . $findgit . "/git/trees/" . $sha . "?recursive=1"; $json = cURL($url); //print_r($json); if (isset($json['message'])) { $html .= "<br><strong>message: " . $json['message'] . "</strong><br>"; } else { if (isset($json['tree'])) { $html .= "<br><table border='0' id='table_git'>"; $html .= "<tr align='center'><td>N</td><td>Файлы</td></tr>"; foreach ($json['tree'] as $value) { $html .= "<tr><td>" . ++$key . "</td><td>" . $value['path'] . "</td></tr>"; } $html .= "</table>"; } else { $html .= "<br><strong>У проекта нет файлов!</strong><br>"; } // ссылки по страницам
} else { if ($key == 'full_name') { $html .= "<tr><td>" . $value . "</td><td><a href='#' id='github_curl' class='github_file' title='" . $value . "'>файлы</a></td><td><a href='#' id='github_curl' class='github_comment' title='" . $value . "'>комментарии</a></td>"; } if ($key == 'created_at') { $html .= "<td>" . $value . "</td></tr>"; //$value=date_parse($value); //$html.="<td>".(isset($value['year'])?$value['year']."-".$value['month']."-".$value['day']." ".$value['hour'].":".$value['minute'].":".$value['second']:"")."</td></tr>"; } } } return $html; } if ($findgit !== "") { // поиск проекта по имени $json = cURL("https://api.github.com/search/repositories?q=" . $findgit . "+in:name&page=" . $page . "&per_page=" . $per_page); // read_github if (isset($json['message'])) { $html .= "<br><strong>message: " . $json['message'] . "</strong><br>"; } else { foreach ($json as $key => $value) { if (is_array($value)) { $html .= "<table border='0' id='table_git'>"; $html .= "<tr align='center'><td>Полное имя</td><td>Файлы</td><td>Комментарии</td><td>Дата создания</td></tr>"; $html .= array_value($value); $html .= "</table>"; } else { if ($key == 'total_count') { $total_count = $value; $html .= "Найдено проектов: " . $value . "<br>"; }