function saveToken($token) { $dotenv = new \Dotenv\Dotenv(__DIR__ . '/../'); $dotenv->load(); $tumblr = getenv('TUMBLR_ACCESS_TOKEN'); $url = 'https://api.vk.com/method/users.get?access_token=' . $token; $response = json_decode(get_curl($url)); if (!isset($response->error)) { $user_id = $response->response[0]->uid; $string = file_get_contents(__DIR__ . "/../.env"); $envArr = explode("\n", $string); $envToken = explode('=', $envArr[0]); $envUID = explode('=', $envArr[1]); $envToken[1] = $token; $envUID[1] = $user_id; $string = $envToken[0] . '=' . $envToken[1] . "\n" . $envUID[0] . '=' . $envUID[1] . "\nTUMBLR_ACCESS_TOKEN=" . $tumblr; $fp = fopen(__DIR__ . '/../.env', 'w'); fputs($fp, $string); fclose($fp); echo '<script>document.location.href = "http://localhost:8888";</script>'; return true; } else { echo 'Error. Please check your access token<br>'; echo '<a href="../index.php">Back</a>'; return false; } }
function uploadImg($photosPost) { $dotenv = new \Dotenv\Dotenv(__DIR__ . '/../'); $dotenv->load(); $token = $_ENV['VK_ACCESS_TOKEN']; $user_uid = $_ENV['USER_UID']; $vk = \getjump\Vk\Core::getInstance()->apiVersion('5.5')->setToken($token); $url = 'https://api.vk.com/method/photos.getWallUploadServer?group_id=101646894&v=5.5&access_token=' . $token; $request = get_curl($url); $data = json_decode($request); $link = $data->response->upload_url; $photo = explode('/||/', $photosPost); $group_id = '101646894'; $postParams = array(); $index = 0; for ($i = 1; $i < count($photo); $i++) { $extention = explode(".", basename($photo[$i])); if ($extention[1] == 'gif') { echo 'You can\'t upload GIF'; die; } $index++; $path = __DIR__ . "/../images/" . basename($photo[$i]); file_put_contents($path, file_get_contents($photo[$i])); $postParams["file" . $index] = "@" . $path; } if ($index < 7) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $link); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); @curl_setopt($ch, CURLOPT_POSTFIELDS, $postParams); $response = curl_exec($ch); $photoParams = json_decode($response); $photo = $photoParams->photo; $server = $photoParams->server; $url = 'https://api.vk.com/method/photos.saveWallPhoto?group_id=' . $group_id . '&v=5.5&photo=' . $photo . '&server=' . $server . '&hash=' . $photoParams->hash . '&access_token=' . $token; $an = get_curl($url); $save = json_decode($an)->response; $attachments = ""; for ($i = 0; $i < count($save); $i++) { $attachments = $attachments . "photo" . $user_uid . "_" . $save[$i]->id . ','; } $url = 'https://api.vk.com/method/wall.post?owner_id=-' . $group_id . '&from_group=1&attachments=' . $attachments . '&access_token=' . $token; $an = get_curl($url); if (!isset(\GuzzleHttp\json_decode($an)->response)) { echo "Unknown error"; return false; } else { echo "Images is successfully uploaded"; return true; } } else { echo "ERROR! You upload more than 6 images OR all your pics are GIFs !"; return false; } }
function get_qqnick($uin) { if ($data = get_curl("http://users.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?get_nick=1&uins=" . $uin)) { $data = str_replace(array('portraitCallBack(', ')'), array('', ''), $data); $data = mb_convert_encoding($data, "UTF-8", "GBK"); $row = json_decode($data, true); return $row[$uin][6]; } }
/** * 获取新的菜单ID * @return mixed */ public function get_menuid() { $apiurl = $this->apiurl . '&v=get_menuid&token=' . $this->token; $data = get_curl($apiurl); $data = json_decode($data, true); if ($data['code'] != 100) { MSG($data['msg']); } return $data['menuid']; }
function request($url, $postData = NULL, $followLocation = true) { $curl = get_curl($url); if ($postData !== NULL) { curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); } curl_setopt($curl, CURLOPT_COOKIE, get_cookie()); $response = curl_exec($curl); $ret = ['header' => []]; $head_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE); $headerRaw = explode("\r\n", substr($response, 0, $head_size)); array_shift($headerRaw); foreach ($headerRaw as $line) { $exp = explode(': ', $line, 2); if (!isset($exp[1])) { continue; } if (strtolower($exp[0]) == 'set-cookie') { set_cookie($exp[1]); } $ret['header'][strtolower($exp[0])] = $exp[1]; } $body = substr($response, $head_size); $ret['body'] = $body; $ret['code'] = curl_getinfo($curl, CURLINFO_HTTP_CODE); $ret['error'] = curl_error($curl); $ret['real_url'] = $url; if (isset($ret['header']['location']) && $followLocation) { global $redirect_cnt; $redirect_cnt += 1; if ($redirect_cnt > 10) { echo 'Max redirect count excceed!<br />Last url: ' . $url . '<br />Request result: <br />'; print_r($ret); die; } $redirect_cnt = 0; $location = $ret['header']['location']; if (substr($location, 0, 4) == 'http') { return request($location); } else { if ($location[0] === '/') { return request(substr($url, 0, strpos($url, '/', 8) + 1) . $location); } else { return request(substr($url, 0, strrpos($url, '/') + 1) . $location); } } } return $ret; }
function qqpanduan($p) { if (!strpos($p, ':')) { $p .= ':'; } $url = 'http://webpresence.qq.com/getonline?Type=1&' . $p; $get = get_curl($url); preg_match_all('/online\\[(\\d+)\\]=(\\d+)\\;/ix', $get, $arr); if ($arr[2][0] == 1) { return '在线'; } else { return '离线'; } }
function get_content($url, $config) { $html = get_curl($url); $html = str_replace(array("\r", "\n"), "", $html); foreach ($config['fields'] as $field => $_c) { if (isset($_c['func'])) { $tmp = cut_html($html, $_c['start'], $_c['end']); $func = $_c['func']; $data[$field] = $func($tmp, $_c['func_result']); } else { $data[$field] = cut_html($html, $_c['start'], $_c['end']); if (isset($_c['replace_code'])) { $data[$field] = replace_code($data[$field], $_c['replace_code']); } } } return $data; }
function ifdx($qq, $jcqq, $sid) { $url = get_curl('http://m.qzone.com/friendship/get_friendship?g_tk=' . time() . '&fromuin=' . $jcqq . '&touin=' . $qq . '&isReverse=1&res_type=4&refresh_type=1&format=json&sid=' . $sid); $json = json_decode($url, true); //print_r($json); if ($json["code"] == 0) { if ($json["message"] == "请先登录") { exit('{"code":-1,"msg":"SKEY已过期!"}'); } else { if ($json["data"]["friendShip"][0]["add_friend_time"] == "-1") { exit('{"code":0,"is":0}'); } else { exit('{"code":0,"is":1}'); } } } else { exit('{"code":-1,"msg":"' . $json["message"] . '"}'); } }
function ifdx($uin, $touin, $sid) { $url = "http://m.qzone.com/friendship/get_friendship?fromuin={$uin}&touin={$touin}&isReverse=1&res_type=4&refresh_type=1&format=json&sid={$sid}"; $json = get_curl($url, 0, 'http://m.qzone.com/infocenter?g_ut=3&g_f=6676'); $json = json_decode($json, true); //print_r($json); if ($json["code"] == 0) { if ($json["message"] == "请先登录") { exit('{"code":-1,"msg":"SID已过期!"}'); } else { if ($json["data"]["friendShip"][0]["add_friend_time"] == "-1") { exit('{"code":0,"is":0}'); } else { exit('{"code":0,"is":1}'); } } } else { exit('{"code":-2,"msg":"' . $json["message"] . '"}'); } }
function wz_paseurl($linkurl, $config) { $html = get_curl($linkurl, '', $config['cookie']); $html = str_replace(array("\r", "\n"), '', $html); $html = str_replace(array("</a>", "</A>"), "</a>\n", $html); preg_match_all('/<a([^>]*)>([^\\/a>].*)<\\/a>/i', $html, $out); $out[1] = array_unique($out[1]); $out[2] = array_unique($out[2]); $data = array(); foreach ($out[1] as $k => $v) { if (preg_match('/href=[\'"]?([^\'" ]*)[\'"]?/i', $v, $match_out)) { if ($config['url_include']) { if (strpos($match_out[1], $config['url_include']) === false) { continue; } } if ($config['url_uninclude']) { if (strpos($match_out[1], $config['url_uninclude']) !== false) { continue; } } $url2 = $match_out[1]; $url2 = fillurl($url2, $linkurl, $config); preg_match('/title=[\'"]?([^\'" ]*)[\'"]?/i', $v, $match_out2); $title = strip_tags($match_out2[1]); if ($title == '') { continue; } $data[$k]['url'] = $url2; $data[$k]['title'] = $title; } else { continue; } } return $data; }
} return $hash & 0x7fffffff; //计算g_tk } header("Content-type: text/html; charset=utf-8"); $uin = $_POST["uin"]; //$sid = $_POST["sid"]; $skey = $_POST["skey"]; $touin = $_POST["touin"]; if (!$uin || !$skey || !$touin) { exit; } $gtk = getGTK($skey); $cookie = 'uin=o0' . $uin . '; skey=' . $skey . ';'; $ua = 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36'; $url = 'http://w.qzone.qq.com/cgi-bin/tfriend/friend_delete_qqfriend.cgi?g_tk=' . $gtk; $post = 'uin=' . $uin . '&fupdate=1&num=1&fuin=' . $touin . '&qzreferrer=http://user.qzone.qq.com/' . $uin . '/myhome/friends'; $data = get_curl($url, $post, 0, $cookie, 0, $ua); preg_match('/callback\\((.*?)\\)\\;/is', $data, $json); $arr = json_decode($json[1], true); if (@array_key_exists('code', $arr) && $arr['code'] == 0) { if ($arr['data']['ret'] == 0) { exit('{"code":0}'); } else { exit('{"code":-2,"msg":"' . $arr["message"] . '"}'); } } elseif ($arr['code'] == -3000) { exit('{"code":-1,"msg":"SKEY已过期!"}'); } else { exit('{"code":-2,"msg":"' . $arr["message"] . '"}'); }
if (function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $output = curl_exec($ch); echo curl_error($ch); curl_close($ch); return $output; } else { return file_get_contents($url); } } $response = get_curl($api); $images = array(); if ($response) { foreach (json_decode($response)->data as $item) { $id = $item->id; $src = $item->images->standard_resolution->url; $thumb = $item->images->thumbnail->url; $url = $item->link; $caption = $item->caption->text; $user = $item->user; $createdAt = $item->created_time; $images[] = array("id" => $id, "src" => htmlspecialchars($src), "thumb" => htmlspecialchars($thumb), "url" => htmlspecialchars($url), "caption" => htmlspecialchars($caption), "user" => $user, "createdAt" => intval($createdAt), "platform" => "instagram"); } } print_r(str_replace('\\/', '/', json_encode($images))); //print_r($response);
function get_ip_city($ip) { $url = 'http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip='; @($city = get_curl($url . $ip)); $city = json_decode($city, true); if ($city['city']) { $location = $city['province'] . $city['city']; } else { $location = $city['province']; } if ($location) { return $location; } else { return false; } }
} die("nada"); } else { //link de watch $pos = strpos($text, 'sDownloadLink":"'); if ($pos !== false) { $text = substr($text, $pos + 16); $pos = strpos($text, '"'); if ($pos !== false) { $fin = strpos($text, '"', $pos); $text = substr($text, 0, $fin); $status = get_curl($text . "?exists=create&container=flv"); if (strpos($status, "<state>true") < 1) { sleep(2); $status = get_curl($text . "?exists=create&container=flv"); if (strpos(get_curl($text . "?exists=create&container=flv"), "<state>true") < 1) { die('{"error":"Try later please","status","' . $status . '"}'); } } $text = $text . "?container=flv"; $text = '[{"url":"http://4.bp.blogspot.com/-csh-pGuVtOU/Um6LUwFsKMI/AAAAAAAAAOM/UoBgOWhutGA/s1600/background.png","height":215,"width":512,"type":"image/gif","medium":"image"},{"url":"' . $text . '","height":358,"width":854,"type":"application/x-shockwave-flash","medium":"video"}]'; if ($mf_cache) { apc_store($mf_cache_key, $text, 900); } if ($is_vi) { apc_store($cache_key, $text, 3600); } die($text); } } die;
$row = $DB->get_row("SELECT * FROM wjob_qq WHERE qq='{$qq}' limit 1"); if ($row['lx'] != $gl && $isadmin == 0) { showmsg('你只能操作自己的QQ哦!'); exit; } if ($row['status2'] != 1) { showmsg('SKEY已过期!'); exit; } $sid = $row['sid']; $skey = $row['skey']; $gtk = getGTK($skey); $cookie = "uin=o0" . $qq . "; skey=" . $skey . ";"; $url = 'http://m.qzone.com/friend/mfriend_list?res_uin=' . $qq . '&res_type=normal&format=json&count_per_page=10&page_index=0&page_type=0&mayknowuin=&qqmailstat=&sid=' . $sid; //$url='http://rc.qzone.qq.com/p/r/cgi-bin/tfriend/friend_show_qqfriends.cgi?uin='.$qq.'&follow_flag=0&groupface_flag=0&fupdate=1&format=json&g_tk='.$gtk; $json = get_curl($url); $json = mb_convert_encoding($json, "UTF-8", "UTF-8"); $arr = json_decode($json, true); //print_r($arr);exit; if (!$arr) { showmsg('好友列表获取失败!'); exit; } elseif ($arr["code"] == -3000) { showmsg('SID已过期!'); exit; } $arr = $arr["data"]["list"]; ?> <script> $(document).ready(function() { $('#startcheck').click(function(){
curl_setopt($ch, CURLOPT_POSTFIELDS, $post); } if ($header) { curl_setopt($ch, CURLOPT_HEADER, true); } if ($cookie) { curl_setopt($ch, CURLOPT_COOKIE, $cookie); } if ($referer) { curl_setopt($ch, CURLOPT_REFERER, $referer); } if ($ua) { curl_setopt($ch, CURLOPT_USERAGENT, $ua); } else { curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Linux; U; Android 4.0.4; es-mx; HTC_One_X Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0"); } if ($nobaody) { curl_setopt($ch, CURLOPT_NOBODY, 1); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $ret = curl_exec($ch); curl_close($ch); return $ret; } $qun = isset($_GET['qun']) ? $_GET['qun'] : '326026548'; $data = get_curl('http://shang.qq.com/wpa/g_wpa_get?guin=' . $qun . '&t=' . time(), 0, 'http://qun.qq.com/join.html'); $arr = json_decode($data, true); $idkey = $arr['result']['data'][0]['key']; $url = 'http://shang.qq.com/wpa/qunwpa?idkey=' . $idkey; header("Location:{$url}"); exit;
?> <table class="table table-bordered table-striped"> <thead> <tr> <td colspan="2">查询结果:</td> </tr> </thead> <tbody> <tr> <td colspan="2"><div class="alerte alert-error">QQ必须为数字</div></td> </tr> </tbody> </table> <?php } else { $url = get_curl("http://qzone-music.qq.com/fcg-bin/cgi_playlist_xml.fcg?json=1&uin=" . $_GET['qq'] . "&g_tk=5381"); //$url = mb_convert_encoding($url, "UTF-8", "GB2312"); //echo $url;exit; //preg_match_all('@{xqusic_id\:.*xsong_name\:\"(.*)\".*qqmusic.qq.com/(.*)\'@Ui',$url,$arr); preg_match_all('@xsong_name\\:\\"(.*)\\"@Ui', $url, $arr); preg_match_all('@xqusic_id:(.*),xctype:(.*),xexpire_time@Ui', $url, $xqusic); preg_match_all('@xsong_url\\:\'(.*)\'@Ui', $url, $arrurl); preg_match_all('@xsinger_name\\:\\"(.*)\\"@Ui', $url, $singger); //print_r($arr);exit; $n = count($arr[1]); ?> <table class="table table-bordered table-striped"> <thead> <tr> <td colspan="2"><?php echo $_GET['qq'];
} } if ($sort_ascending) { $array = array_reverse($temp_array); } else { $array = $temp_array; } } function get_curl($url) { if (function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $output = curl_exec($ch); echo curl_error($ch); curl_close($ch); return $output; } else { return file_get_contents($url); } } $instagramResponse = json_decode(get_curl($instagramApi), true); $twitterResponse = json_decode(get_curl($twitterApi), true); $result = array_merge($instagramResponse, $twitterResponse); sksort($result, "createdAt"); print_r(json_encode($result)); die;
function getCountryForIpJson2($ip = null){ // http://freegeoip.net/xml/89.162.209.186 if (!isset($ip)){ $ip = $_SERVER['REMOTE_ADDR']; } $countryCode = false; $url = 'http://freegeoip.net/json/'.$ip; if ($content = get_curl($url)){ $params = json_decode($content); if ($params->country_code){ $countryCode = strtoupper($params->country_code); } }else{ $countryCode = getCountryForIpJson($ip); } return $countryCode; }
echo '<hr/>'; if ($res['code'] == 1) { if (!class_exists('ZipArchive') || ini_get('acl.app_id') || defined("SAE_ACCESSKEY")) { echo '您的空间不支持自动更新,请手动下载更新包并覆盖到程序根目录!<br/> 更新包下载:<a href="' . $res['file'] . '" class="btn btn-primary">update.zip</a>'; } else { echo '<a href="index.php?mod=update&act=do" class="btn btn-primary btn-block">立即更新到最新版本</a>'; } echo '<hr/><div class="well">' . $res['uplog'] . '</div>'; } break; case 'do': if (isset($_GET['test'])) { $checkurl = 'http://cron.aliapp.com/api/check.php?test=true&ver=' . VERSION; } $res = get_curl($checkurl); $res = json_decode($res, true); $RemoteFile = $res['file']; $ZipFile = "Archive.zip"; copy($RemoteFile, $ZipFile) or die("无法下载更新包文件!" . '<a href="index.php?mod=update">返回上级</a>'); if (zipExtract($ZipFile, ROOT)) { echo "程序更新成功!<br>"; echo '<a href="./">返回首页</a>'; unlink($ZipFile); } else { echo "无法解压文件!<br>"; echo '<a href="index.php?mod=update">返回上级</a>'; if (file_exists($ZipFile)) { unlink($ZipFile); } }
function rest_delete($table, $id) { $ch = get_curl($table, $id); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); return execute_curl($ch); }
<?php include 'apikeys.php'; include 'streams.php'; include 'curl.php'; include 'guzzle.php'; include 'json_output.php'; date_default_timezone_set('America/New_York'); $plsget = 'http://api.placester.com/api/v2.1/listings?api_key=' . $plsapi; $ddpost = 'https://app.datadoghq.com/api/v1/events?api_key=' . $ddapi; pls_output('GET Placester Listings with Stream', get_stream($plsget)); pls_output('GET Placester Listings with cURL', get_curl($plsget)); pls_output('GET Placester Listings with Guzzle', get_guzzle($plsget)); $ddparams = array('title' => 'web service test', 'text' => 'test'); $ddparams['text'] = "current time is " . date("F j, Y, g:i(s) a"); dd_output('POST Datadog Event with Stream', post_stream($ddpost, $ddparams)); $ddparams['text'] = "current time is " . date("F j, Y, g:i(s) a"); dd_output('POST Datadog Event with cURL', post_curl($ddpost, $ddparams)); $ddparams['text'] = "current time is " . date("F j, Y, g:i(s) a"); dd_output('POST Datadog Event with Guzzle', post_guzzle($ddpost, $ddparams));
<li><a href="index.php?mod=qqlist">QQ管理</a></li> <li><a href="index.php?mod=list&qq=<?php echo $qq; ?> "><?php echo $qq; ?> </a></li> <li class="active">空间状态检测</li> </ol> <div class="panel panel-primary"> <div class="panel-heading" style="background: #56892E;"> <h3 class="panel-title" align="center">空间状态检测</h3> </div> <?php $url = get_curl("http://user.qzone.qq.com/" . $qq . ""); if (preg_match('@不符合互联网相关安全规范@', $url)) { $qzone = '您的QQ空间已被永久封闭'; } elseif (preg_match('@您访问的空间需要权限@', $url)) { $qzone = '您的空间设置了好友权限<br>如果设置好友访问,可以不用管本提示'; } elseif (preg_match('@\\[http\\:\\/\\/' . $qq . '\\.qzone\\.qq\\.com\\]@', $url)) { $qzone = '您的空间一切正常'; } elseif (preg_match('@您需要登录才可以访问QQ空间@', $url)) { $qzone = '您的空间,被强制需要登录QQ号才能正常访问<br>具体错误原因是:空间设置或腾讯限制'; } elseif (preg_match('@暂不支持非好友访问@', $url)) { $qzone = '您的QQ空间已被封单项,非互相好友不能访问'; } else { $qzone = '您的空间一切正常'; } ?> <table class="table table-bordered table-striped">
<?php require_once "vendor/autoload.php"; require_once "classes/tumblrParser.php"; require_once 'classes/getCurl.php'; session_start(); $dotenv = new \Dotenv\Dotenv('.'); $dotenv->load(); $token = $_ENV['VK_ACCESS_TOKEN']; $user_uid = $_ENV['USER_UID']; $url = 'https://api.vk.com/method/users.get?access_token=' . $token; $response = json_decode(get_curl($url)); ?> <!DOCTYPE html> <html> <head> <title>Parser</title> <meta charset="utf-8"> <link href="css/bootstrap.min.css" rel="stylesheet"> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/main.js"></script> </head> <body> <form method="get" class="text-center"> <input type="text" placeholder="Type blog name" name="name"> <button type="submit" class="btn">Send</button> </form> <?php if ($token != '') {
$print = json_decode($json, true); print_r($print); return $print; } function show_json_array($json_array, $debug = false) { echo "<pre class='json_array'>"; print_r($json_array); echo "</pre>"; } function doiData() { $title = $json_array["title"]; $author_array = $json_array["author"]; $jtitle = $json_array["container-title"]; $pages = $json_array["page"]; $volume = $json_array["volume"]; $issue = $json_array["issue"]; $issn_array = $json_array["ISSN"]; $url = $json_array["URL"]; $year = $json_array["issued"]["date-parts"][0][0]; } //$doi_url = doi_url($doi); $json = get_curl($doi); $json_array = get_json_array($json); ?> <?php show_json_array($json_array, $debug);
public function test_get_curl() { $this->assertNotEmpty(get_curl('http://google.com')); }
$secret_iv = 'hacklamcho'; // hash $key = hash('sha256', $secret_key); // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning $iv = substr(hash('sha256', $secret_iv), 0, 16); if ($action == 'encrypt') { $output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv); $output = base64_encode($output); } else { if ($action == 'decrypt') { $output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv); } } return $output; } if ($link) { $link = showLinkEpisode($link); if (stripos($link, 'picasaweb.google.com/lh/photo/')) { $text = get_curl($link); $arr = explode(',"media":{', $text); $ct = $arr[1]; $arr2 = explode('}],"title":', $ct); $ct2 = $arr2[0]; $text = $ct2; } else { $text = get_curl($link); } echo $text; } ?>
} } } protected function _hexToString($hex) { if (!is_string($hex)) { return null; } $char = ''; for ($i = 0; $i < strlen($hex); $i += 2) { $char .= chr(hexdec($hex[$i] . $hex[$i + 1])); } return $char; } } $zing = get_curl($_POST["diachia"]); preg_match_all('/xmlURL: "([^>]*)",/U', $zing, $link_zing); $xml = str_replace('media', 'media-embed', $link_zing[1][0]); $sourceXML = file_get_contents('compress.zlib://' . $xml); $f360 = explode('<source streamingType="1"><![CDATA[', $sourceXML); $f360 = explode(']]></source>', $f360[1]); $getf360 = new zing(); $getf360->_text = '' . $f360[0] . ''; if ($getf360->_decrypt() != false) { } if ($getf360->_result != '') { $f480 = explode('<f480 streamingType="1"><![CDATA[', $sourceXML); $f480 = explode(']]></f480>', $f480[1]); $getf480 = new zing(); $getf480->_text = '' . $f480[0] . ''; if ($getf480->_decrypt() != false) {
function do_get($url, $header = false) { global $LastGETURL; global $LastGETMethod; global $LastHeadersSent; global $last_http_response; global $LastHeadersReceived; $LastGETURL = $url; $LastGETMethod = false; $LastHeadersSent = false; $last_http_response = false; $LastHeadersReceived = false; $lastGETResponse = false; $LastGETMethod = "CURL"; $lastGETResponse = get_curl($url, $header); if ($lastGETResponse !== false) { return $lastGETResponse; } $LastGETMethod = "Stream"; $lastGETResponse = get_stream($url, $header); if ($lastGETResponse !== false) { return $lastGETResponse; } /* $LastGETMethod = "Socket"; $lastGETResponse = get_socket($url, $header); if ( $lastGETResponse !== false ) return $response; */ $LastGETMethod = "Error"; echo "Unable to GET<br/>\n"; echo "Url={$url} <br/>\n"; echo "Header:<br/>\n{$header}<br/>\n"; throw new Exception("Unable to get"); }
<?php header('content-type:text/html;charset=utf-8'); require_once './common.php'; $url = 'http://apis.baidu.com/apistore/weatherservice/weather?citypinyin=shanghai'; $data = json_decode(get_curl($url), true); echo '<pre>'; print_r($data);