function get_info() { $get_info = "https://graph.qq.com/user/get_info?" . "access_token=" . $_SESSION['access_token'] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=json"; $info = get_url_contents($get_info); $arr = json_decode($info, true); return $arr; }
function add_share() { //发布一条动态的接口地址, 不要更改!! $url = "https://graph.qq.com/share/add_share?" . "access_token=" . $_SESSION["access_token"] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=json" . "&title=" . urlencode($_REQUEST["title"]) . "&url=" . urlencode($_REQUEST["url"]) . "&comment=" . urlencode($_REQUEST["comment"]) . "&summary=" . urlencode($_REQUEST["summary"]) . "&images=" . urlencode($_REQUEST["images"]); //echo $url; $ret = get_url_contents($url); }
function RunImageSearch($text) { $enc = urlencode($text); $imageSearchJson = get_url_contents('http://ajax.googleapis.com/ajax/services/search/images?v=1.0&safe=active&rsz=8&imgsz=medium&q=' . $enc); $imageresponse = json_decode($imageSearchJson); return $imageresponse; }
function qq_callback() { global $setting; if ($_REQUEST['state'] == tcookie('state')) { //csrf $token_url = "https://graph.qq.com/oauth2.0/token?grant_type=authorization_code&" . "client_id=" . $setting["qqlogin_appid"] . "&redirect_uri=" . urlencode(SITE_URL . "plugin/qqlogin/qq_callback.php") . "&client_secret=" . $setting["qqlogin_key"] . "&code=" . $_REQUEST["code"]; $response = get_url_contents($token_url); if (strpos($response, "callback") !== false) { $lpos = strpos($response, "("); $rpos = strrpos($response, ")"); $response = substr($response, $lpos + 1, $rpos - $lpos - 1); $msg = json_decode($response); if (isset($msg->error)) { echo "<h3>error:</h3>" . $msg->error; echo "<h3>msg :</h3>" . $msg->error_description; exit; } } $params = array(); parse_str($response, $params); header("Location:" . SITE_URL . "index.php?user/register/" . $params["access_token"]); } else { echo "The state does not match. You may be a victim of CSRF."; } }
function run_work($href) { global $db2, $tablepre; $sql = "select * from {$tablepre}collection_content where url = '{$href}'"; $query = $db2->query($sql); $row = $db2->fetch_array($query); if ($row) { echo "<font color = 'red'>" . $href . "已收集过</font><br>"; return null; } else { $from = get_url_contents($href); if ($from) { preg_match('/charset=\\"?(.*?)\\"/si', $from, $charset); if ($charset[1]) { $da = new Readability($from, $charset[1]); $data = $da->getContent(); if (preg_match('/(.*?)[_-].*?/si', $data['title'], $title)) { $data['title'] = $title[1]; } if (strlen($data['content']) > 1000) { return $data; } } } else { return null; } } }
function list_album() { //获取相册列表的接口地址, 不要更改!! $url = "https://graph.qq.com/photo/list_album?" . "access_token=" . $_SESSION["access_token"] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=json"; //echo $url; $ret = get_url_contents($url); return $ret; }
function get_openid() { global $db, $tpf, $settings, $timestamp, $onlineip, $user_tpl_dir; $graph_url = "https://graph.qq.com/oauth2.0/me?access_token=" . $_SESSION['access_token']; $str = get_url_contents($graph_url); if (strpos($str, "callback") !== false) { $lpos = strpos($str, "("); $rpos = strrpos($str, ")"); $str = substr($str, $lpos + 1, $rpos - $lpos - 1); } $user = json_decode($str); if (isset($user->error)) { echo "<h3>error:</h3>" . $user->error; echo "<h3>msg :</h3>" . $user->error_description; exit; } //debug //echo("Hello " . $user->openid); //set openid to session $_SESSION["openid"] = $user->openid; if ($_SESSION["openid"]) { $arr = get_user_info(); $nickname = $arr["nickname"]; $abs_path = '../../../'; $flid = @$db->result_first("select flid from {$tpf}fastlogin where auth_type='qq' and auth_name='{$_SESSION["openid"]}'"); if ($flid) { $userid = @$db->result_first("select userid from {$tpf}fastlogin where flid='{$flid}'"); if ($userid) { $rs = $db->fetch_one_array("select userid,gid,username,password,email from {$tpf}users where userid='{$userid}'"); if ($rs) { pd_setcookie('phpdisk_zcore_info', pd_encode("{$rs[userid]}\t{$rs[gid]}\t{$rs[username]}\t{$rs[password]}\t{$rs[email]}")); //login $ins = array('last_login_time' => $timestamp, 'last_login_ip' => $onlineip); $db->query_unbuffered("update {$tpf}users set " . $db->sql_array($ins) . " where userid='{$userid}'"); $db->query_unbuffered("update {$tpf}fastlogin set " . $db->sql_array($ins) . " where flid='{$flid}'"); //echo 'Login Success'; redirect($settings[phpdisk_url] . urr("mydisk", ""), '', 0); } unset($rs); } else { // to bind username $title = __('bind_disk_name'); require_once template_echo('pd_fastlogin', $user_tpl_dir); } } else { $ins = array('nickname' => $nickname, 'auth_type' => 'qq', 'auth_name' => $_SESSION["openid"], 'last_login_time' => $timestamp, 'last_login_ip' => $onlineip); $db->query_unbuffered("insert into {$tpf}fastlogin set " . $db->sql_array($ins) . ""); $flid = $db->insert_id(); //echo 'Login Success'; $title = __('bind_disk_name'); require_once template_echo('pd_fastlogin', $user_tpl_dir); } } else { exit('QQ Login Error'); } }
function is_twitch_online() { $twitch_stream = get_url_contents("https://api.twitch.tv/kraken/streams?channel=" . get_theme_mod('twitch_profile') . ""); $result = json_decode($twitch_stream, true); if ($result['streams'] != null) { return true; } else { return false; } }
function get_html($siteurl, $config) { $str = get_url_contents($siteurl); $str = str_replace('http://bt.doc5188.com', $config['siteurl'], $str); $str = str_replace('优搜磁力搜索', $config['title'], $str); $str = str_replace('/statics/', $config['erji'] . 'statics/', $str); $str = preg_replace('/<title>([\\s\\S]*?)<\\/title>/i', '<title>' . $config['title'] . ' - 做最全的资源搜索引擎 - 没有搜不到,只有想不到!</title>', $str); $str = preg_replace('/<div style="display:none;">([\\s\\S]*?)<\\/div>/i', '<div class="foot">友情链接:' . $config['link'] . '</div><div style="display:none;">' . $config['tongji'] . '</div>', $str); $str = str_replace('action="/search"', 'action="' . $config['erji'] . 'search.php"', $str); return $str; }
function getlist($type, $page) { $url = "http://list.pptv.com/channel_list.html?page={$page}&type={$type}&sort=6"; $content = get_url_contents($url, 'http://list.pptv.com/'); preg_match_all('/<a class="ui-list-ct".+href=\'(.+)\\?.+\'.+title="(.+)".+<img.+data-src2="(.+)"/Uis', $content, $matches); $list = array(); foreach ($matches[2] as $k => $v) { $list[] = array('title' => $v, 'id' => get_encode($matches[1][$k]), 'pic' => $matches[3][$k], 'actor' => '主演', 'director' => '导演', 'area' => '地方', 'year' => '2015'); } return $list; }
/** * 此函数,供Callback处调用,如果返回false,认证失败,否则返回以下哈希表: * last_key -> callback得到的last_key * oauth_token -> 上述lastkey中的oauth_token * oauth_token_secret -> 上述lastkey中的oauth_token_secret * user_id -> 用户ID(注意不是QQ号,是QQ的openid) * user_name -> 用户昵称 * user_email -> 暂不提供 */ function AuthCallback_qq() { if ($_REQUEST['state'] == $_SESSION['state']) { //csrf $token_url = "https://graph.qq.com/oauth2.0/token?grant_type=authorization_code&" . "client_id=" . $_SESSION["appid"] . "&redirect_uri=" . urlencode($_SESSION["callback"]) . "&client_secret=" . $_SESSION["appkey"] . "&code=" . $_REQUEST["code"]; $response = get_url_contents($token_url); if (strpos($response, "callback") !== false) { /* $lpos = strpos($response, "("); $rpos = strrpos($response, ")"); $response = substr($response, $lpos + 1, $rpos - $lpos - 1); $msg = json_decode($response); if (isset($msg->error)) { echo "<h3>error:</h3>" . $msg->error; echo "<h3>msg :</h3>" . $msg->error_description; exit; } */ return null; } } $params = array(); parse_str($response, $params); //debug //print_r($params); //set access token to session $_SESSION["access_token"] = $params["access_token"]; $graph_url = "https://graph.qq.com/oauth2.0/me?access_token=" . $_SESSION['access_token']; $str = get_url_contents($graph_url); if (strpos($str, "callback") !== false) { $lpos = strpos($str, "("); $rpos = strrpos($str, ")"); $str = substr($str, $lpos + 1, $rpos - $lpos - 1); } $user = json_decode($str); if (isset($user->error)) { return null; } //debug //echo("Hello " . $user->openid); //set openid to session $_SESSION["openid"] = $user->openid; $rtn = array(); $get_user_info = "https://graph.qq.com/user/get_user_info?" . "access_token=" . $_SESSION['access_token'] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=json"; $info = get_url_contents($get_user_info); $arr = json_decode($info, true); $rtn['user_id'] = $user->openid; $rtn['user_name'] = $arr["nickname"]; //$rtn['user_email'] = $rtn['user_id'] . '@openid_qq'; //$rtn['user_email'] = 'qqqqq'. '@openid_qq'; //$rtn['user_id'] = 'aaaaaaa'; return $rtn; }
function getlist($type, $cate, $page) { $url = "http://list.iqiyi.com/www/{$type}/-{$cate}---------0---11-{$page}-1-iqiyi--.html"; //$url = "http://list.pptv.com/channel_list.html?page={$page}&type={$type}&sort=6"; $content = get_url_contents($url, 'http://list.iqiyi.com/'); //<ul class="site-piclist site-piclist-180236 site-piclist-auto"> preg_match('/<ul class="site-piclist site-piclist-180236 site-piclist-auto">.+<\\/ul>/Uis', $content, $matche); preg_match_all('/<li>.+<a.+title="(.+)".+href="(.*)".+class="site-piclist_pic_link".+<img.+rseat=".+".+src = "(.+)".+\\/>.+<\\/li>/Uis', $matche[0], $matches); $list = array(); foreach ($matches[1] as $k => $v) { $list[] = array('title' => $v, 'id' => get_encode($matches[2][$k]), 'pic' => $matches[3][$k], 'actor' => '主演', 'director' => '导演', 'area' => '地方', 'year' => '2015'); } return $list; }
function get_openid() { $graph_url = "https://graph.qq.com/oauth2.0/me?access_token=" . $_SESSION['access_token']; $str = get_url_contents($graph_url); if (strpos($str, "callback") !== false) { $lpos = strpos($str, "("); $rpos = strrpos($str, ")"); $str = substr($str, $lpos + 1, $rpos - $lpos - 1); } $user = json_decode($str); if (isset($user->error)) { echo "<h3>error:</h3>" . $user->error; echo "<h3>msg :</h3>" . $user->error_description; exit; } $_SESSION["openid"] = $user->openid; }
public function priv_joke($line, $args) { $channel = $line["to"]; $nick = $line["fromNick"]; $data = get_url_contents("http://api.icndb.com/jokes/random"); $data = $data["html"]; // ICNDB has escaped slashes in JSON response. $data = stripslashes($data); $joke = json_decode($data); if ($joke) { if (isset($joke->value->joke)) { $this->ircClass->privMsg($channel, html_entity_decode($joke->value->joke)); } } else { $this->ircClass->privMsg($channel, "I don't feel like laughing today. :("); } }
function get_user_info() { $graph_url = "https://graph.qq.com/user/get_user_info?access_token=" . $_SESSION['access_token'] . "&oauth_consumer_key=" . $_SESSION['appid'] . "&openid=" . $_SESSION['openid'] . "&format=json"; $str = get_url_contents($graph_url); if (strpos($str, "callback") !== false) { $lpos = strpos($str, "("); $rpos = strrpos($str, ")"); $str = substr($str, $lpos + 1, $rpos - $lpos - 1); } $user = json_decode($str); if (isset($user->error)) { echo "<h3>error:</h3>" . $user->error; echo "<h3>msg :</h3>" . $user->error_description; exit; } //debug //echo("Hello " . $user->openid); //set openid to session return $user; }
function get_openid() { global $access_token; $graph_url = "https://graph.qq.com/oauth2.0/me?access_token=" . $access_token; $str = get_url_contents($graph_url); if (strpos($str, "callback") !== false) { $lpos = strpos($str, "("); $rpos = strrpos($str, ")"); $str = substr($str, $lpos + 1, $rpos - $lpos - 1); } $user = json_decode($str); if (isset($user->error)) { echo "<h3>error:</h3>" . $user->error; echo "<h3>msg :</h3>" . $user->error_description; exit; } //debug //echo("Hello " . $user->openid); //set openid to session $openid = $user->openid; }
public function priv_showIssue($line, $args) { $channel = strtolower($line['to']); $nick = $line['fromNick']; // !issue [issue_num] [repo] $issuenum = $args["nargs"] > 0 ? $args['arg1'] : null; $repo = $args["nargs"] > 1 ? $args['arg2'] : $this->ghcfg["repo"]; if ($issuenum) { // list issue $url = 'https://api.github.com/repos/' . str_replace('%2F', '/', urlencode($repo)) . '/issues/' . $issuenum; $data = get_url_contents($url); $data = json_decode($data["html"]); if (empty($data)) { //$this->bot->say('Fetching issue failed'); $this->ircClass->privMsg($channel, "Fetching failed, tried getting issue {$issuenum} from {$repo}"); return; } $this->ircClass->privMsg($channel, (isset($data->pull_request) ? 'Pull request' : 'Issue') . ' #' . $data->number . ': ' . $data->title . ' (' . $data->comments . ' comment(s))'); $this->ircClass->privMsg($channel, 'Reported by ' . $data->user->login . ', current status: ' . $data->state); $this->ircClass->privMsg($channel, substr(preg_replace('/\\s\\s+/', ' ', $data->body), 0, 250)); $this->ircClass->privMsg($channel, 'More information: ' . $data->html_url); } else { $url = 'https://api.github.com/repos/' . str_replace('%2F', '/', urlencode($repo)) . '/issues'; $data = get_url_contents($url); $result = json_decode($data["html"]); $i = 0; if (count($result)) { $this->ircClass->privMsg($channel, "Sending last few issues for {$repo} in privmsg"); foreach ($result as $issue) { if ($i >= 5) { break; } $this->ircClass->privMsg($nick, (isset($issue->pull_request) ? '[Pull]' : '[Issue]') . ' #' . $issue->number . ': ' . $issue->title . ' (reported by ' . $issue->user->login . ', status: ' . $issue->state . ') <' . $issue->html_url . '>'); $i++; } } else { $this->ircClass->privMsg($channel, "no issues to display for {$repo}"); } } }
function get_openid() { $graph_url = "https://graph.qq.com/oauth2.0/me?access_token=" . $_SESSION['access_token']; $str = get_url_contents($graph_url); if (strpos($str, "callback") !== false) { $lpos = strpos($str, "("); $rpos = strrpos($str, ")"); $str = substr($str, $lpos + 1, $rpos - $lpos - 1); } $user = json_decode($str); if (isset($user->error)) { echo "<h3>error:</h3>" . $user->error; echo "<h3>msg :</h3>" . $user->error_description; exit; } //debug //echo("Hello " . $user->openid); //set openid to session $_SESSION["openid"] = $user->openid; //33h ao v3-b 10 33h ao.co m $_SESSION['m'] = $_GET['m']; //判断是否手机登陆 }
function add_share($param) { //发布一条动态的接口地址, 不要更改!! $url = "https://graph.qq.com/share/add_share?"; $url .= "access_token=" . $_SESSION['qqzone']["access_token"]; $url .= "&oauth_consumer_key=" . $_SESSION['qqzone']["appid"]; $url .= "&openid=" . $_SESSION['qqzone']["openid"]; $url .= "&format=json"; $url .= "&title=" . urlencode($param['title']); $url .= "&url=" . urlencode($param['url']); $url .= "&comment=" . urlencode($param['comment']); $url .= "&summary=" . urlencode($param['summary']); $url .= "&images=" . urlencode($param['images']); $url .= "&source=" . (isset($param['source']) && !empty($param['source']) ? $param['source'] : 1); //分享的场景,对应上文接口说明的5。取值说明:1.通过网页 2.通过手机 3.通过软件 4.通过IPHONE 5.通过 IPAD。 $url .= "&type=" . (isset($param['type']) && !empty($param['type']) ? $param['type'] : 4); //分享内容的类型。4表示网页;5表示视频(type=5时,必须传入playurl) if ($param['type'] == 5) { $url .= "&type={$param['type']}"; } $url .= "&site=" . urlencode($data['site_name']); $url .= "&nswb=1"; $ret = get_url_contents($url); }
{ print 'Send to Winunciator: ' . $run_param['URL_address_2'] . ':' . $run_param['URL_port_2'] . '/' . $first_caller_id . '|' . $thenumber .'<br><br>'; } } if ($run_param['URL_address_3'] && $run_param['URL_port_3'] != '') { $value = get_url_contents($run_param['URL_address_3'] . ':' . $run_param['URL_port_3'] . '/' . $first_caller_id . '|' . $thenumber); if($debug) { print 'Send to Winunciator: ' . $run_param['URL_address_3'] . ':' . $run_param['URL_port_3'] . '/' . $first_caller_id . '|' . $thenumber .'<br><br>'; } } if ($run_param['URL_address_4'] && $run_param['URL_port_4'] != '') { $value = get_url_contents($run_param['URL_address_4'] . ':' . $run_param['URL_port_4'] . '/' . $first_caller_id . '|' . $thenumber); if($debug) { print 'Send to Winunciator: ' . $run_param['URL_address_4'] . ':' . $run_param['URL_port_4'] . '/' . $first_caller_id . '|' . $thenumber .'<br><br>'; } } if ($run_param['URL_address_5'] && $run_param['URL_port_5'] != '') { $value = get_url_contents($run_param['URL_address_5'] . ':' . $run_param['URL_port_5'] . '/' . $first_caller_id . '|' . $thenumber); if($debug) { print 'Send to Winunciator: ' . $run_param['URL_address_5'] . ':' . $run_param['URL_port_5'] . '/' . $first_caller_id . '|' . $thenumber .'<br><br>'; } } } ?>
$response = substr($response, $lpos + 1, $rpos - $lpos - 1); $msg = json_decode($response); if (isset($msg->error)) { echo "<h3>error:</h3>" . $msg->error; echo "<h3>msg :</h3>" . $msg->error_description; exit; } } $params = array(); parse_str($response, $params); $access_token = $params["access_token"]; if (empty($access_token)) { exit("access_token is empty"); } $graph_url = "https://graph.qq.com/oauth2.0/me?access_token=" . $access_token; $str = get_url_contents($graph_url); if (strpos($str, "callback") !== false) { $lpos = strpos($str, "("); $rpos = strrpos($str, ")"); $str = substr($str, $lpos + 1, $rpos - $lpos - 1); } $user = json_decode($str); if (isset($user->error)) { echo "<h3>error:</h3>" . $user->error; echo "<h3>msg :</h3>" . $user->error_description; exit; } $_SESSION["openid"] = $user->openid; if (empty($_SESSION['openid'])) { exit("error"); }
}else{ $number_error = true; } if($number_error) { if($debug) { print "Skipping Source - Non AU number: ".$thenumber."<br>\n"; } } else { // Search personlookup.com.au $url = "http://personlookup.com.au/browse.aspx?type=search&supplied=number&value=".urlencode($fullnum)."&state=all"; $value = get_url_contents($url); $name = ""; $pattern = "/<div class=\"col\">(.+)<\/div>[^<]+<div class=\"col\">[^<]+<\/div>[^<]+<div class=\"col\">.*".$num1.".* ".$num2." ".$num3."<\/div>/"; preg_match($pattern, $value, $match); if(isset($match[1])){ $name = trim(strip_tags($match[1])); } // If we found a match, return it if(strlen($name) > 1) { $caller_id = $name; } else if($debug)
$thenumber = substr($thenumber,2); } else if (substr($thenumber,0,4) == '0039') { $thenumber = substr($thenumber,4); } else if (substr($thenumber,0,5) == '01139') { $thenumber = substr($thenumber,5); } } $url = "http://www.paginebianche.it/execute.cgi?ver=default&font=default&btt=1&ts=106&cb=8&l=it&mr=10&rk=&om="; $url = $url . "&qs=" . $thenumber; $sresult = get_url_contents($url); preg_match_all('=<h3.class\=\"org\"[^>]*>(.*)</h3>=siU', $sresult, $sname); if (count($sname[1]) > 0) { $sname = $sname[1][0]; //$sname = str_replace(chr(160), ' ', $sname[1][0]); } else { $sname = ""; } if ($sname != "") {
/** * load and parse a CSS file * * @param string $file */ function load_css_file($file) { global $_dompdf_warnings; // Prevent circular references if (isset($this->_loaded_files[$file])) { return; } $this->_loaded_files[$file] = true; $parsed_url = explode_url($file); list($this->_protocol, $this->_base_host, $this->_base_path, $filename) = $parsed_url; if (!DOMPDF_ENABLE_REMOTE && ($this->_protocol != "" && $this->_protocol !== "file://")) { record_warnings(E_USER_WARNING, "Remote CSS file '{$file}' requested, but DOMPDF_ENABLE_REMOTE is false.", __FILE__, __LINE__); return; } // Fix submitted by Nick Oostveen for aliased directory support: if ($this->_protocol == "") { $file = $this->_base_path . $filename; } else { $file = build_url($this->_protocol, $this->_base_host, $this->_base_path, $filename); } set_error_handler("record_warnings"); $css = get_url_contents($file, false); restore_error_handler(); if ($css == "") { record_warnings(E_USER_WARNING, "Unable to load css file {$file}", __FILE__, __LINE__); return; } $this->_parse_css($css); }
$provider = trim($_GET['provider']); $bib = trim($_GET['bib']); $item = $_GET['item']; //parse the item $itemArray = explode("|", $item); $location = trim($itemArray[0]); //strip strange characters not handled by Safari from location $location = preg_replace('/[^A-Za-z0-9\\-_\\.\\s]/', "", $location); $location = trim($location); $callNumber = trim($itemArray[1]); $item = "\nLoc: " . $location . "\nCall: " . $callNumber; //echo "document.write('Debug: ".$location." ".$callNumber."');"; //Change this url to your own catalog $url = "http://swan.mobius.umsystem.edu:2082/record=" . $bib; //Use the bib number to get the title information for the item from the catalog $catalogItemPage = get_url_contents($url); preg_match('/fieldtag=t(.*)fieldtag=p/s', $catalogItemPage, $matches); //get the right secton of code preg_match('/<strong>([^:]*).*<\\/strong>/s', $matches[1], $matches2); //grab the title text before the colon $title = trim($matches2[1]); //verify that the call number and location are listed on the page for extra security if (!strstr($catalogItemPage, $callNumber) || !strstr($catalogItemPage, $location)) { echo "alert('There was a problem. Message not sent!');"; exit; } //defined variables. Set the from address and subject as desired $fromAddress = '*****@*****.**'; $providers = array('cingular' => '@mobile.mycingular.com', 'tmobile' => '@tmomail.net', 'virgin' => '@vmobl.com', 'sprint' => '@messaging.sprintpcs.com', 'nextel' => '@messaging.nextel.com', 'verizon' => '@vtext.com', 'northwest' => '@mynwmcell.com', 'cricket' => '@mms.mycricket.com', 'qwest' => '@qwestmp.com', 'uscellular' => '@email.uscc.net'); //remove any non-numeric characters from the phone number $number = preg_replace('/[^\\d]/', '', $phoneNumber);
<?php include '../init.php'; $id = $_GET['id']; $url = get_decode($id); $content = get_url_contents($url); preg_match('/var webcfg \\=.+"pid":(\\d+),.+"cat_id":(\\d+),.+"share_content"/Uis', $content, $matches); //var webcfg = {"id":18735751,"id_encode":"h6MhngZs3Bp9ib2M","pid":0 $list = array('PPTV' => array('播放' => $url)); if (!empty($matches[1])) { $jurl = "http://v.pptv.com/show/videoList?&cb=videoList&pid={$matches[1]}&page=1&pageSize=99999&cat_id={$matches[2]}&maxPage=&autoType=&highligh"; $content = get_url_contents($jurl, $url); $content = substr($content, strpos($content, '(') + 1); $content = trim($content, '; )'); $data = json_decode($content, true); if (is_array($data)) { $list = array(); foreach ($data['data']['list'] as $key => $value) { $pkey = '第' . (floor($key / 50) + 1) . '页'; $list[$pkey][$value['epTitle']] = $value['url']; } } } $tpl = Template::getInstance(); $tpl->assign('list', $list); $tpl->assign('player', 'pptv.com'); $tpl->display('get_sites.html');
function signup_social() { if ($_SERVER['REQUEST_METHOD'] == 'GET') { if (isset($_GET['code']) && isset($_GET['type']) && $_GET['type'] == 'sina') { $code = $_GET['code']; $url = "https://api.weibo.com/oauth2/access_token"; $data = "client_id=your_sina_appkey&4221439169_client_secret=sina_client_secret&4211a1b7d19c1f33c568368dc9927d18_type=authorization_code&redirect_uri=" . urlencode(home_url()) . "&code=" . $code; //替换成你自己的appkey和appsecret $output = json_decode(do_post($url, $data)); $sina_access_token = $output->access_token; $sina_uid = $output->uid; if (empty($sina_uid)) { wp_redirect(home_url('/?3')); //获取失败的时候直接返回首页 exit; } if (is_user_logged_in()) { $this_user = wp_get_current_user(); update_user_meta($this_user->ID, "sina_uid", $sina_uid); update_user_meta($this_user->ID, "sina_access_token", $sina_access_token); wp_redirect(home_url('/me/setting?4')); //已登录用户授权 } else { $user_fb = get_users(array("meta_key " => "sina_uid", "meta_value" => $sina_uid)); if (is_wp_error($user_fb) || !count($user_fb)) { $get_user_info = "https://api.weibo.com/2/users/show.json?uid=" . $sina_uid . "&access_token=" . $sina_access_token; $data = get_url_contents($get_user_info); $str = json_decode($data, true); $username = $str['screen_name']; $login_name = wp_create_nonce($sina_uid); $random_password = wp_generate_password($length = 12, $include_standard_special_chars = false); $userdata = array('user_login' => $login_name, 'display_name' => $username, 'user_pass' => $random_password, 'nick_name' => $username); $user_id = wp_insert_user($userdata); wp_signon(array("user_login" => $login_name, "user_password" => $random_password), false); update_user_meta($user_id, "sina_uid", $sina_uid); update_user_meta($user_id, "sina_access_token", $sina_access_token); wp_redirect(home_url('/?1')); //创建帐号成功 } else { update_user_meta($user_fb[0]->ID, "sina_access_token", $sina_access_token); wp_set_auth_cookie($user_fb[0]->ID); wp_redirect(home_url('/?2')); //已绑定,直接登录。 } } } } }
<?php require 'include/curl.php'; require 'include/slack.php'; require 'include/slack.config.php'; $command = BuildSlashCommand($_REQUEST); $hook = $config['slack']['hook']; //use one or the other of $emoji or $iconurl $emoji = null; $iconurl = "http://upload.wikimedia.org/wikipedia/en/1/13/Stick_figure.png"; $comicid = $command->Text; $xkcdapi = "http://xkcd.com/{$comicid}/info.0.json"; $json = get_url_contents($xkcdapi); $xkcdresponse = json_decode($json); $alt = $xkcdresponse->alt; $image = $xkcdresponse->img; $payload = "{$image}\n<http://xkcd.com/{$comicid}/|{$alt}>\n"; $ret = slack_incoming_hook_post($hook, "xkcdbot", $command->ChannelName, $iconurl, $emoji, $payload); if ($ret != "ok") { print_r("@tdm, gifbot got this response when it tried to post to the incoming hook.\n{$ret}"); }
<?php include '../init.php'; $idmap = array(1 => 1, 2 => 2, 3 => 4, 4 => 6); $videoid = intval($_GET['videoid']); $videoid = $videoid ? $videoid : 1; $maptype = $idmap[$videoid]; $url = "http://list.iqiyi.com/www/{$maptype}/----------0---11-1-1-iqiyi--.html"; $content = get_url_contents($url); preg_match('/<h3>类型:<\\/h3>.+<\\/ul>/Uis', $content, $matches); //<a href="/www/1/-8---------0---11-1-1-iqiyi--.html">喜剧</a> preg_match_all('/<a.+href="\\/www\\/\\d+\\/-(\\d+)-.+">(.+)<\\/a>/Uis', $matches[0], $matches); $typelist = array(); $typelist = array('0' => '全部'); foreach ($matches[1] as $k => $v) { $typelist[$v] = $matches[2][$k]; } $tpl = Template::getInstance(); $tpl->assign('videoid', $maptype); $tpl->assign('videos', $maplist[$videoid]); $tpl->assign('typelist', $typelist); $tpl->display('vod_xml.html');
function onajaxordersadmin() { $page = 1; $qtypeInfo = $_ENV['qtype']->GetQType(intval($this->post['qtype'])); $qtypeInfo['trading'] = unserialize($qtypeInfo['trading']); $Order = array(); $checked = in_array(trim($this->post['old_order']), array(0, -1)) ? ' selected = "selected" ' : ''; $Order[0] = '<option value = -1 ' . $checked . '>' . 无订单 . "</option>"; ksort($Order); if ($this->post['type'] == 1 || $this->post['type'] == 2) { //我购买的商品 if ($this->post['type'] == 1) { $url = $qtypeInfo['trading']['buyerOrderUrl']; } else { $url = $qtypeInfo['trading']['sellerOrderUrl']; } $url .= "&uid=" . $this->post['author'] . "&ps=20&p=" . $page; $this->post['start_date'] != '' && ($url .= '&mindate=' . $this->post['start_date']); $this->post['end_date'] != '' && ($url .= '&maxdate=' . $this->post['end_date']); $url .= '&ts=' . $qtypeInfo['trading']['ServiceType']; $this->post['dd'] != '' && ($url .= '&oc=' . $this->post['dd']); $rs = get_url_contents($url); echo $url . "<br>"; $result = json_decode($rs, true); if (!empty($result['OrderList'])) { foreach ($result['OrderList'] as $OrderList) { $checked = trim($OrderList['Id']) == trim($this->post['old_order']) ? ' selected = "selected" ' : ''; $Order[$OrderList['Id']] = '<option value = ' . $OrderList['Id'] . '|' . $OrderList['GameId'] . '|' . $OrderList['OperatorId'] . '|' . $OrderList['AreaId'] . '|' . $OrderList['ServerId'] . ' ' . $checked . '>' . $OrderList['Id'] . '/' . $OrderList['GameName'] . '/' . $OrderList['AreaName'] . '/' . $OrderList['ServerName'] . "</option>"; } } } elseif ($this->post['type'] == 3) { //我的发布单 $url = $qtypeInfo['trading']['sellingOrderUrl']; $url .= "?uid=" . $this->post['author'] . "&ps=5&p=" . $page; $url .= '&ts=' . $qtypeInfo['trading']['ServiceType']; $this->post['start_date'] != '' && ($url .= '&mindate=' . $this->post['start_date']); $this->post['end_date'] != '' && ($url .= '&maxdate=' . $this->post['end_date']); $rs = get_url_contents($url); $result = json_decode($rs, true); if (!empty($result['BizofferList'])) { foreach ($result['BizofferList'] as $OrderList) { $checked = trim($OrderList['Id']) == trim($this->post['old_order']) ? ' selected = "selected" ' : ''; $Order[$OrderList['Id']] = '<option value = ' . $OrderList['Id'] . '|' . $OrderList['GameId'] . '|' . $OrderList['OperatorId'] . '|' . $OrderList['AreaId'] . '|' . $OrderList['ServerId'] . ' ' . $checked . '>' . $OrderList['Id'] . '/' . $OrderList['GameName'] . '/' . $OrderList['AreaName'] . '/' . $OrderList['ServerName'] . "</option>"; } } } $str = implode("", $Order); echo $str; }