/** * DO SOMETHING AND SEND LOG VIA POST * @param array $logData content with details of the log */ function set_log(array $logData) { $log_name = $logData['level'] . '_' . $logData['log_name']; // PATH TO WHERE API IS HOSTED $url = 'http://localhost/logs-notification/Logs/notification'; return do_post($logData, $url); }
/** * Call the Yahoo Contact API * @param string $consumer_key obtained when you registered your app * @param string $consumer_secret obtained when you registered your app * @param string $guid obtained from getacctok * @param string $access_token obtained from getacctok * @param string $access_token_secret obtained from getacctok * @param bool $usePost use HTTP POST instead of GET * @param bool $passOAuthInHeader pass the OAuth credentials in HTTP header * @return response string with token or empty array on error */ function call_yql($consumer_key, $consumer_secret, $querynum, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true) { $retarr = array(); // return value $response = array(); if ($querynum == 1) { $url = 'http://query.yahooapis.com/v1/yql'; // Show my profile $params['q'] = 'select * from social.profile where guid=me'; } elseif ($querynum == 2) { $url = 'http://query.yahooapis.com/v1/yql'; // Find my friends $params['q'] = 'select * from social.connections where owner_guid=me'; } else { // Since this information is public, use the non oauth endpoint 'public' $url = 'http://query.yahooapis.com/v1/public/yql'; // Find all sushi restaurants in SF order by number of ratings desc $params['q'] = 'select Title,Address,Rating from local.search where query="sushi" and location="san francisco, ca"|sort(field="Rating.TotalRatings",descending="true")'; } $params['format'] = 'json'; $params['callback'] = 'cbfunc'; $params['oauth_version'] = '1.0'; $params['oauth_nonce'] = mt_rand(); $params['oauth_timestamp'] = time(); $params['oauth_consumer_key'] = $consumer_key; $params['oauth_token'] = $access_token; // compute hmac-sha1 signature and add it to the params list $params['oauth_signature_method'] = 'HMAC-SHA1'; $params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret); // Pass OAuth credentials in a separate header or in the query string if ($passOAuthInHeader) { $query_parameter_string = oauth_http_build_query($params, true); $header = build_oauth_header($params, "yahooapis.com"); $headers[] = $header; } else { $query_parameter_string = oauth_http_build_query($params); } // POST or GET the request if ($usePost) { $request_url = $url; logit("call_yql:INFO:request_url:{$request_url}"); logit("call_yql:INFO:post_body:{$query_parameter_string}"); $headers[] = 'Content-Type: application/x-www-form-urlencoded'; $response = do_post($request_url, $query_parameter_string, 80, $headers); } else { $request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : ''); logit("call_yql:INFO:request_url:{$request_url}"); $response = do_get($request_url, 80, $headers); } // extract successful response if (!empty($response)) { list($info, $header, $body) = $response; if ($body) { logit("call_yql:INFO:response:"); print json_pretty_print($body); } $retarr = $response; } return $retarr; }
function add_blog() { //发表QQ空间日志的接口地址, 不要更改!! $url = "https://graph.qq.com/blog/add_one_blog"; $data = "access_token=" . $_SESSION["access_token"] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=" . $_POST["format"] . "&title=" . $_POST["title"] . "&content=" . $_POST["content"]; $ret = do_post($url, $data); return $ret; }
function add_album() { //创建QQ空间相册的接口地址, 不要更改!! $url = "https://graph.qq.com/photo/add_album"; $data = "access_token=" . $_SESSION["access_token"] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=" . $_POST["format"] . "&albumname=" . urlencode($_POST["albumname"]) . "&albumdesc=" . urlencode($_POST["albumdesc"]) . "&priv=" . $_POST["priv"]; //echo $data; $ret = do_post($url, $data); return $ret; }
function add_weibo() { //发表微博的接口地址, 不要更改!! $url = "https://graph.qq.com/wb/add_weibo"; $data = "access_token=" . $_SESSION["access_token"] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=" . $_POST["format"] . "&type=" . $_POST["type"] . "&content=" . urlencode($_POST["content"]) . "&img=" . urlencode($_POST["img"]); //echo $data; $ret = do_post($url, $data); return $ret; }
function add_topic() { //发表QQ空间日志的接口地址, 不要更改!! $url = "https://graph.qq.com/shuoshuo/add_topic"; $data = "access_token=" . $_SESSION["access_token"] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=" . $_POST["format"] . "&richtype=" . $_POST["richtype"] . "&richval=" . urlencode($_POST["richval"]) . "&con=" . urlencode($_POST["con"]) . "&lbs_nm=" . $_POST["lbs_nm"] . "&lbs_x=" . $_POST["lbs_x"] . "&lbs_y=" . $_POST["lbs_y"] . "&third_source=" . $_POST["third_source"]; //echo $data; $ret = do_post($url, $data); return $ret; }
/** * Call the Yahoo Contact API * @param string $consumer_key obtained when you registered your app * @param string $consumer_secret obtained when you registered your app * @param string $guid obtained from getacctok * @param string $access_token obtained from getacctok * @param string $access_token_secret obtained from getacctok * @param bool $usePost use HTTP POST instead of GET * @param bool $passOAuthInHeader pass the OAuth credentials in HTTP header * @return response string with token or empty array on error */ function callcontact($consumer_key, $consumer_secret, $guid, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true, $_count) { $retarr = array(); // return value $response = array(); $url = 'http://social.yahooapis.com/v1/user/' . $guid . '/contacts?count=' . $_count; $params['format'] = 'xml'; $params['view'] = 'compact'; $params['oauth_version'] = '1.0'; $params['oauth_nonce'] = mt_rand(); $params['oauth_timestamp'] = time(); $params['oauth_consumer_key'] = $consumer_key; $params['oauth_token'] = $access_token; // compute hmac-sha1 signature and add it to the params list $params['oauth_signature_method'] = 'HMAC-SHA1'; //$params['oauth_signature'] = // oauth_compute_hmac_sig($usePost? 'POST' : 'GET', $url, $params, // $consumer_secret, $access_token_secret); echo ','; echo $params['oauth_nonce']; echo ','; echo $params['oauth_timestamp']; echo ','; echo oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret); exit(0); // Pass OAuth credentials in a separate header or in the query string if ($passOAuthInHeader) { $query_parameter_string = oauth_http_build_query($params, true); $header = build_oauth_header($params, "yahooapis.com"); $headers[] = $header; } else { $query_parameter_string = oauth_http_build_query($params); } // POST or GET the request if ($usePost && 0) { $request_url = $url; logit("callcontact:INFO:request_url:{$request_url}"); logit("callcontact:INFO:post_body:{$query_parameter_string}"); $headers[] = 'Content-Type: application/x-www-form-urlencoded'; $response = do_post($request_url, $query_parameter_string, 80, $headers); } else { $request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : ''); logit("callcontact:INFO:request_url:{$request_url}"); $response = do_get($request_url, 80, $headers); } // extract successful response if (!empty($response)) { list($info, $header, $body) = $response; if ($body) { logit("callcontact:INFO:response:"); print json_pretty_print($body); } $retarr = $response; } return $retarr; }
/** * Refresh an access token using an expired request token * @param string $consumer_key obtained when you registered your app * @param string $consumer_secret obtained when you registered your app * @param string $old_access_token obtained previously * @param string $old_token_secret obtained previously * @param string $oauth_session_handle obtained previously * @param bool $usePost use HTTP POST instead of GET (default false) * @param bool $useHmacSha1Sig use HMAC-SHA1 signature (default false) * @return response string with token or empty array on error */ function refresh_access_token($consumer_key, $consumer_secret, $old_access_token, $old_token_secret, $oauth_session_handle, $usePost = false, $useHmacSha1Sig = true, $passOAuthInHeader = true) { $retarr = array(); // return value $response = array(); $url = 'https://api.login.yahoo.com/oauth/v2/get_token'; $params['oauth_version'] = '1.0'; $params['oauth_nonce'] = mt_rand(); $params['oauth_timestamp'] = time(); $params['oauth_consumer_key'] = $consumer_key; $params['oauth_token'] = $old_access_token; $params['oauth_session_handle'] = $oauth_session_handle; // compute signature and add it to the params list if ($useHmacSha1Sig) { $params['oauth_signature_method'] = 'HMAC-SHA1'; $params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $old_token_secret); } else { $params['oauth_signature_method'] = 'PLAINTEXT'; $params['oauth_signature'] = oauth_compute_plaintext_sig($consumer_secret, $old_token_secret); } // Pass OAuth credentials in a separate header or in the query string if ($passOAuthInHeader) { $query_parameter_string = oauth_http_build_query($params, true); $header = build_oauth_header($params, "yahooapis.com"); $headers[] = $header; } else { $query_parameter_string = oauth_http_build_query($params); } // POST or GET the request if ($usePost) { $request_url = $url; logit("refacctok:INFO:request_url:{$request_url}"); logit("refacctok:INFO:post_body:{$query_parameter_string}"); $headers[] = 'Content-Type: application/x-www-form-urlencoded'; $response = do_post($request_url, $query_parameter_string, 443, $headers); } else { $request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : ''); logit("refacctok:INFO:request_url:{$request_url}"); $response = do_get($request_url, 443, $headers); } // extract successful response if (!empty($response)) { list($info, $header, $body) = $response; $body_parsed = oauth_parse_str($body); if (!empty($body_parsed)) { logit("getacctok:INFO:response_body_parsed:"); print_r($body_parsed); } $retarr = $response; $retarr[] = $body_parsed; } return $retarr; }
function get_request_token($callback = 'oob', $usePost = false, $useHmacSha1Sig = true, $passOAuthInHeader = false) { $retarr = array(); // return value $response = array(); $params['oauth_version'] = '1.0'; $params['oauth_nonce'] = mt_rand(); $params['oauth_timestamp'] = time(); $params['oauth_consumer_key'] = $this->consumer_key; $params['oauth_callback'] = $callback; $headers = array(); // compute signature and add it to the params list if ($useHmacSha1Sig) { $params['oauth_signature_method'] = 'HMAC-SHA1'; $params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $this->reqUrl, $params, $this->consumer_secret, null); } else { $params['oauth_signature_method'] = 'PLAINTEXT'; $params['oauth_signature'] = oauth_compute_plaintext_sig($this->consumer_secret, null); } // Pass OAuth credentials in a separate header or in the query string if ($passOAuthInHeader) { $query_parameter_string = oauth_http_build_query($params, true); $header = build_oauth_header($params, "Twitter API"); $headers[] = $header; } else { $query_parameter_string = oauth_http_build_query($params); } // POST or GET the request if ($usePost) { $request_url = $this->reqUrl; logit("getreqtok:INFO:request_url:{$request_url}"); logit("getreqtok:INFO:post_body:{$query_parameter_string}"); $headers[] = 'Content-Type: application/x-www-form-urlencoded'; $response = do_post($request_url, $query_parameter_string, 80, $headers); } else { $request_url = $this->reqUrl . ($query_parameter_string ? '?' . $query_parameter_string : ''); logit("getreqtok:INFO:request_url:{$request_url}"); $response = do_get($request_url, 80, $headers); } // extract successful response if (!empty($response)) { list($info, $header, $body) = $response; $body_parsed = oauth_parse_str($body); if (!empty($body_parsed)) { logit("getreqtok:INFO:response_body_parsed:"); } $retarr = $response; $retarr[] = $body_parsed; } return $retarr; }
/** * Call twitter to post a tweet * @param string $consumer_key obtained when you registered your app * @param string $consumer_secret obtained when you registered your app * @param string $status_message * @param string $access_token obtained from get_request_token * @param string $access_token_secret obtained from get_request_token * @param bool $usePost use HTTP POST instead of GET * @param bool $passOAuthInHeader pass OAuth credentials in HTTP header * @return response string or empty array on error */ function post_tweet($consumer_key, $consumer_secret, $status_message, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true) { $retarr = array(); // return value $response = array(); //$url = 'http://api.twitter.com/1/statuses/update.json'; $url = 'http://api.twitter.com/1.1/friendships/incoming.json'; //$params['status'] = $status_message; $params['oauth_version'] = '1.0'; $params['oauth_nonce'] = mt_rand(); $params['oauth_timestamp'] = time(); $params['oauth_consumer_key'] = $consumer_key; $params['oauth_token'] = $access_token; // compute hmac-sha1 signature and add it to the params list $params['oauth_signature_method'] = 'HMAC-SHA1'; $params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret); // Pass OAuth credentials in a separate header or in the query string if ($passOAuthInHeader) { $query_parameter_string = oauth_http_build_query($params, true); $header = build_oauth_header($params, "Twitter API"); $headers[] = $header; } else { $query_parameter_string = oauth_http_build_query($params); } // POST or GET the request if ($usePost) { $request_url = $url; logit("tweet:INFO:request_url:{$request_url}"); logit("tweet:INFO:post_body:{$query_parameter_string}"); $headers[] = 'Content-Type: application/x-www-form-urlencoded'; $response = do_post($request_url, $query_parameter_string, 80, $headers); } else { $request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : ''); logit("tweet:INFO:request_url:{$request_url}"); $response = do_get($request_url, 80, $headers); } // extract successful response if (!empty($response)) { list($info, $header, $body) = $response; if ($body) { logit("tweet:INFO:response:"); print json_pretty_print($body); } $retarr = $response; } return $retarr; }
/** * Call the Yahoo Contact API * @param string $consumer_key obtained when you registered your app * @param string $consumer_secret obtained when you registered your app * @param string $guid obtained from getacctok * @param string $access_token obtained from getacctok * @param string $access_token_secret obtained from getacctok * @param bool $usePost use HTTP POST instead of GET * @param bool $passOAuthInHeader pass the OAuth credentials in HTTP header * @return response string with token or empty array on error */ function postcontact($consumer_key, $consumer_secret, $guid, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true) { $retarr = array(); // return value $response = array(); $post_body = '{"contact":{"fields":[{"type":"name","value":{"givenName":"John","middleName":"","familyName":"Doe","prefix":"","suffix":"","givenNameSound":"","familyNameSound":""}},{"type":"email","value":"*****@*****.**"}]}}'; $url = 'http://social.yahooapis.com/v1/user/' . $guid . '/contacts'; $params['oauth_version'] = '1.0'; $params['oauth_nonce'] = mt_rand(); $params['oauth_timestamp'] = time(); $params['oauth_consumer_key'] = $consumer_key; $params['oauth_token'] = $access_token; // compute hmac-sha1 signature and add it to the params list $params['oauth_signature_method'] = 'HMAC-SHA1'; $params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret); // Pass OAuth credentials in a separate header or in the query string if ($passOAuthInHeader) { $query_parameter_string = oauth_http_build_query($params, true); $header = build_oauth_header($params, "yahooapis.com"); $headers[] = $header; $request_url = $url; } else { $query_parameter_string = oauth_http_build_query($params); $request_url = $url . '?' . $query_parameter_string; } // POST or GET the request if ($usePost) { logit("postcontact:INFO:request_url:{$request_url}"); logit("postcontact:INFO:post_body:{$post_body}"); $headers[] = 'Content-Type: application/json'; $response = do_post($request_url, $post_body, 80, $headers); } else { logit("postcontact:INFO:request_url:{$request_url}"); $response = do_get($request_url, 80, $headers); } // extract successful response if (!empty($response)) { list($info, $header, $body) = $response; if ($body) { logit("postcontact:INFO:response:"); print json_pretty_print($body); } $retarr = $response; } return $retarr; }
function init() { myconnect(); # get global $pdf_file; $pdf_file = get_get('pdf'); # lock global $db; global $lock; $sql = "SELECT * FROM zamky WHERE pdf = " . $db->quote($pdf_file) . ";"; $result = $db->query($sql); foreach ($result as $row) { $lock = $row; break; } # post if (count($_POST) > 0) { do_post(); redir_to_get(); } return true; }
function yim_create_session() { $oauth_data = $_SESSION['oauth_data']; $oauth_token = $oauth_data['oauth_token']; $access_token_secret = $oauth_data['oauth_token_secret']; $url = 'http://developer.messenger.yahooapis.com/v1/session'; $params = yim_get_basic_oauth_params(); $params['fieldsBuddyList'] = '+groups'; $params['oauth_token'] = $oauth_token; $params['oauth_signature'] = oauth_compute_plaintext_sig(OAUTH_CONSUMER_SECRET, $access_token_secret); $query_param_string = oauth_http_build_query($params); $url = $url . '?' . $query_param_string; $headers = array(); $headers[] = 'Content-Type: application/json;charset=utf-8'; $response = do_post($url, '{}', 80, $headers); yim_fail_if_not_ok($response, 'Could not create session'); $json_session_data = $response[2]; $json_handler = new JSON_obj(); $data = $json_handler->decode($json_session_data); $_SESSION['session_data'] = $data; return $data; }
function upload_pic() { //上传照片的接口地址, 不要更改!! $url = "https://graph.qq.com/photo/upload_pic"; $params["access_token"] = $_SESSION["access_token"]; $params["oauth_consumer_key"] = $_SESSION["appid"]; $params["openid"] = $_SESSION["openid"]; $params["photodesc"] = urlencode($_POST["photodesc"]); $params["title"] = urlencode($_POST["title"]); $params["albumid"] = urlencode($_POST["albumid"]); $params["x"] = $_POST["x"]; $params["y"] = $_POST["y"]; $params["format"] = $_POST["format"]; //处理上传图片 foreach ($_FILES as $filename => $filevalue) { $tmpfile = dirname($filevalue["tmp_name"]) . "/" . $filevalue["name"]; move_uploaded_file($filevalue["tmp_name"], $tmpfile); $params[$filename] = "@{$tmpfile}"; } $ret = do_post($url, $params); unlink($tmpfile); //echo $tmpfile; return $ret; }
/** * @brief 发布一条动态(feeds)到QQ空间中,展现给好友.请求需经过URL编码,编码时请遵循 RFC 1738 * * @param $appid * @param $appkey * @param $access_token * @param $access_token_secret * @param $openid */ function add_feeds($appid, $appkey, $access_token, $access_token_secret, $openid) { //发布一条动态的接口地址, 不要更改!! $url = "http://openapi.qzone.qq.com/share/add_share"; echo do_post($url, $appid, $appkey, $access_token, $access_token_secret, $openid); }
function get_request_token($oauth, $usePost = false, $useHmacSha1Sig = true, $passOAuthInHeader = false) { $retarr = array(); // return value $response = array(); $url = 'https://www.google.com/accounts/OAuthGetRequestToken'; $params['oauth_version'] = '1.0'; $params['oauth_nonce'] = mt_rand(); $params['oauth_timestamp'] = time(); $params['oauth_consumer_key'] = $oauth->oauth_consumer_key; $params['oauth_callback'] = $oauth->callback; $params['scope'] = 'https://www.google.com/m8/feeds'; // compute signature and add it to the params list if ($useHmacSha1Sig) { $params['oauth_signature_method'] = 'HMAC-SHA1'; $params['oauth_signature'] = $oauth->oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $oauth->oauth_consumer_secret, null); } else { echo "signature method not support"; } // Pass OAuth credentials in a separate header or in the query string if ($passOAuthInHeader) { $query_parameter_string = $oauth->oauth_http_build_query($params, FALSE); $header = $oauth->build_oauth_header($params); $headers[] = $header; } else { $query_parameter_string = $oauth->oauth_http_build_query($params); } // POST or GET the request if ($usePost) { $request_url = $url; $oauth->logit("getreqtok:INFO:request_url:{$request_url}"); $oauth->logit("getreqtok:INFO:post_body:{$query_parameter_string}"); $headers[] = 'Content-Type: application/x-www-form-urlencoded'; $response = do_post($request_url, $query_parameter_string, 443, $headers); } else { $request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : ''); $oauth->logit("getreqtok:INFO:request_url:{$request_url}"); $response = $oauth->do_get($request_url, 443, $headers); } // extract successful response if (!empty($response)) { list($info, $header, $body) = $response; $body_parsed = $oauth->oauth_parse_str($body); if (!empty($body_parsed)) { $oauth->logit("getreqtok:INFO:response_body_parsed:"); //print_r($body_parsed); } $retarr = $response; $retarr[] = $body_parsed; } return $body_parsed; }
<?php !function_exists('html') && exit('ERR'); if ($action == 'mod') { $div_db[div_w] = $div_w; $div_db[div_h] = $div_h; $div_db[div_bgcolor] = $div_bgcolor; $div = addslashes(serialize($div_db)); $typesystem = 0; //插入或更新标签库 do_post(); } $rsdb = get_label(); $rsdb[hide] ? $hide_1 = 'checked' : ($hide_0 = 'checked'); if ($rsdb[js_time]) { $js_time = 'checked'; } @extract(unserialize($rsdb[divcode])); $div_width && ($div_w = $div_width); $div_height && ($div_h = $div_height); $rsdb[code] = "<iframe src='http://weather.265.com/weather.htm' width='168' height='54' frameborder='no' border='0' marginwidth='0' marginheight='0' scrolling='no'></iframe>"; require "head.php"; require "template/label/hack_code.htm"; require "foot.php";
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')); //已绑定,直接登录。 } } } } }
/** * @brief 登录用户发表一篇新日志到QQ空间.请求需经过URL编码,编码时请遵循 RFC 1738 * * @param $appid * @param $appkey * @param $access_token * @param $access_token_secret * @param $openid */ function add_blog($appid, $appkey, $access_token, $access_token_secret, $openid) { //发表QQ空间日志的接口地址, 不要更改!! $url = "http://openapi.qzone.qq.com/blog/add_one_blog"; echo do_post($url, $appid, $appkey, $access_token, $access_token_secret, $openid); }
<?php $post = json_decode($_POST['data'], TRUE); #print_r($post); $post_type = $post['type']; $post_opt = $post['opt']; $post_data = $post['data']; $mod_file = 'mod_' . $post_type . '.php'; clearstatcache(); if (file_exists($mod_file)) { include $mod_file; do_post($post); } else { $ret = array('ret' => 1, 'error' => "module {$mod_file} not found", 'result' => array()); print_r(json_encode($ret)); exit; }
$result = read_result(); } else { $result = $ret; } if ($action == $action_signin && $result == "success") { $cookie = read_cookie(); if ($cookie == "NULL") { $withcookie = ""; } else { $withcookie = "\r\nCookie: lang=en;" . $cookie; } if ($mydlink_num == "NULL" || $dlinkfootprint == "NULL") { $result = i18n("dlink number or foorprint not exist."); } else { //echo "num= ".$mydlink_num." foot= ". $dlinkfootprint; $ret = do_post($post_str_adddev, $post_url_adddev, $withcookie); if ($ret == 0) { $result = read_result(); $add_success_ret = $mydlink_num . ":"; //compare dlink_num only $ret = strstr($result, $add_success_ret); if (isempty($ret) == 0) { $result = "success"; do_set_status(); } } else { $result = $ret; } } } }
function oncomStatisfy() { $id = isset($this->post['id']) ? intval($this->post['id']) : -1; // 问题id $type = isset($this->post['type']) ? intval($this->post['type']) : -1; $author_id = isset($this->post['userid']) ? trim($this->post['userid']) : ''; if ($id == -1 || $type == -1 || $author_id == '') { exit('0'); } $now = time(); $assess = $this->db->fetch_first("SELECT assess,asnum FROM " . DB_TABLEPRE . "complain WHERE id={$id}"); if (empty($assess['assess'])) { $url = "http://complain.5173esb.com/Sc/PostEvaluate.aspx"; $data = "scid={$id}&iJudgeInt={$type}&userid={$author_id}&sign=" . config::TS_SIGN; do_post($url, $data); } if ($this->post['type'] == 1) { $this->db->query("UPDATE " . DB_TABLEPRE . "complain SET `asnum`=asnum+1,`assess`=1,`astime`={$now},`status`=3 WHERE id={$id}"); exit('1'); } elseif ($this->post['type'] == 2) { $this->db->query("UPDATE " . DB_TABLEPRE . "complain SET `asnum`=asnum+1,`assess`=2,`astime`={$now},`status`=3 WHERE id={$id}"); exit('2'); } }
public function getOnlineOperator($StartTime, $EndTime, $OperatorList) { if (count($OperatorList) > 0) { $PostData = array('StartTime' => $StartTime, 'EndTime' => $EndTime, 'OperatorList' => $OperatorList); } else { $PostData = array('StartTime' => $StartTime, 'EndTime' => $EndTime); } $PostData = rawurldecode(json_encode($PostData)); $ComplainKey = "%YOJNCWQRIWA:OE YV)ENVRMQOWV {)RWCJNWQBCVCE WQMEJC WROL VR"; $ComplainUrl = "http://complain.5173.com/sc/GetWorkStatus.ashx"; $returnData = do_post($ComplainUrl, array('data' => $PostData, 'key' => md5($PostData . $ComplainKey))); $returnData = json_decode($returnData, true); return $returnData; }
/** * @brief 登录用户创建QQ空间相册.请求需经过URL编码,编码时请遵循 RFC 1738 * * @param $appid * @param $appkey * @param $access_token * @param $access_token_secret * @param $openid */ function add_album($appid, $appkey, $access_token, $access_token_secret, $openid) { //创建QQ空间相册的接口地址, 不要更改!! $url = "http://openapi.qzone.qq.com/photo/add_album"; echo do_post($url, $appid, $appkey, $access_token, $access_token_secret, $openid); }
function process($user, $action) { say("< " . $action); $request = json_decode($action, true); if (empty($request)) { say("ERROR: invalid request body"); return; } if (!array_key_exists("method", $request) || !array_key_exists("resource", $request) || !array_key_exists("msg_id", $request)) { say("ERROR: missing mandatory property"); return; } $method = $request["method"]; $response = NULL; if ($method == "POST" && $request["resource"] == "/slideshare") { $response = get_slideshare($request); } else { if ($method == "POST") { $response = do_post($user, $request); } else { if ($method == "PUT") { $response = do_put($user, $request); } else { if ($method == "GET") { $response = do_get($user, $request); } else { if ($method == "DELETE") { $response = do_delete($user, $request); } else { if ($method == "SUBSCRIBE") { $response = do_subscribe($user, $request); } else { if ($method == "UNSUBSCRIBE") { $response = do_unsubscribe($user, $request); } else { if ($method == "NOTIFY") { $response = do_notify($user, $request); } else { // this is an unknown request $response = array("code" => "failed", "reason" => "unknown command " . $method . " " . $resource); } } } } } } } } $response['msg_id'] = $request['msg_id']; //header("Content-type: application/json"); send($user, json_encode($response)); }
/** * complain站点返回要同步的问题 * @param $data post值 * @param $complainAnswerUrl 接口url * @param $complainKey 秘钥 * @return mixed */ function complainAnswerBackData($data, $complainAnswerUrl, $complainKey) { $postData = json_encode($data); // post数据提交给complain站点 $returnData = do_post($complainAnswerUrl, array('data' => $data, 'key' => md5($data . $complainKey))); $decodeReturnData = json_decode($returnData, true); return $decodeReturnData; }
/** * complain站点投诉问题同步sc */ private function Revoke() { $this->load('complain'); $RevokeQueue = $_ENV['complain']->getRevokeQueue(); foreach ($RevokeQueue as $key => $value) { $id = $value['scid']; $ComplainInfo = $_ENV['complain']->Get($id); $startDate = date("Y-m-01", strtotime("-3 month", time())); if ($ComplainInfo['time'] < strtotime($startDate)) { $_ENV['complain']->delRevokeQueue($id); } else { $t = array(); foreach ($value as $k => $y) { if ($k != 'id') { $t[] = $k . "=" . urlencode($y); } else { $id = $y; } } $data = implode("&", $t); $url = "http://complain.5173.com/Sc/PostCancel.aspx"; $data = $data . "&sign=" . config::TS_SIGN; echo "id:" . $id . "\n"; $result = do_post($url, $data); $result_arr = json_decode($result, true); echo "return:" . $result_arr['return'] . "\n"; if ($result_arr['return'] == 1) { $_ENV['complain']->delRevokeQueue($id); } } } }
function upload($text, $pic, $opt, $url) { $graph_url = "https://graph.qq.com/share/add_share"; $data = array("access_token" => $opt["access_token"], "oauth_consumer_key" => APPID, "openid" => $opt["openid"], "title" => $text, "url" => $url, "images" => $pic); $ret = do_post($graph_url, $data); $arr = json_decode($ret, TRUE); return $arr; }
function run_on_name($ch, $name, $pageNo) { global $g_debug; $DOT = "."; $g_ofile = urlencode($name) . $DOT . time() . $DOT . "email"; $fhandle = fopen($g_ofile, "w"); while (1) { $dtime = time() . "999"; $params = array("pageNo" => $pageNo, "type" => "page", "archive" => "0", "d" => $dtime); $qstring = http_build_query($params); $pageUrl = "http://toostep.com/searchUserAjax.html?" . $qstring; if ($g_debug) { print_r($params); printf("page = %s \n", $pageUrl); } $pageHtml = do_post($ch, $pageUrl, $name); if ($g_debug) { echo $pageHtml; } $profiles = get_profile_url($pageHtml); if (sizeof($profiles) == 0) { fclose($fhandle); //name processing finished return; } //print_r($profiles); exit ; //use profiles to get emails foreach ($profiles as $profile) { $data = get_profile_email($profile); $buffer = NULL; if (empty($data) || is_null($data)) { $buffer = sprintf("__NO_DATA__ %s \n", $profile); } else { $buffer = sprintf("__DATA__ %s|%s|%s|%s \n", $data["email"], $data["name"], $data["title"], $data["company"]); } fwrite($fhandle, $buffer); } $pageNo++; } }
function default_assess($num) { $n = 1; $this->load('complain'); while ($n > 0) { $NoAssessData = $_ENV['complain']->getAssessData($num, "id,assess,asnum,atime"); $n = count($NoAssessData); $logData = ""; $backInfo = array(1 => 'success', 2 => 'failure'); foreach ($NoAssessData as $value) { $now = time(); $threeDayAfter = $value['atime'] + 259200 - $now; if ($threeDayAfter <= 0 && $value['assess'] == 0) { $result = $_ENV['complain']->updateAssess($value['id'], 1); if ($result) { $url = "http://complain.5173esb.com/Sc/PostEvaluate.aspx"; $data = "scid={$value['id']}&iJudgeInt=1&userid='defaultAssess'&sign=" . config::TS_SIGN; do_post($url, $data); $logData .= $data . "\r\n"; } $logData .= "id={$value['id']} {$backInfo[$result]} \r\n"; } } if ($logData) { } } }