function send_lms($phone) { global $_gl; global $my_db; //$s_url = "http://www.belif-factory.com/MOBILE/coupon_page.belif?mid=".$phone; $httpmethod = "POST"; $url = "http://api.openapi.io/ppurio/1/message/lms/minivertising"; $clientKey = "MTAyMC0xMzg3MzUwNzE3NTQ3LWNlMTU4OTRiLTc4MGItNDQ4MS05NTg5LTRiNzgwYjM0ODEyYw=="; $contentType = "Content-Type: application/x-www-form-urlencoded"; //$response = sendRequest($httpmethod, $url, $clientKey, $contentType, $phone, $s_url); $response = sendRequest($httpmethod, $url, $clientKey, $contentType, $phone); $json_data = json_decode($response, true); /* 받아온 결과값을 DB에 저장 및 Variation */ $query3 = "INSERT INTO sms_info(send_phone, send_status, cmid, send_regdate) values('" . $phone . "','" . $json_data['result_code'] . "','" . $json_data['cmid'] . "','" . date("Y-m-d H:i:s") . "')"; $result3 = mysqli_query($my_db, $query3); //$query2 = "UPDATE member_info SET mb_lms='Y' WHERE mb_phone='".$phone."'"; //$result2 = mysqli_query($my_db, $query2); if ($json_data['result_code'] == "200") { $flag = "Y"; } else { $flag = "N"; } return $flag; }
function getStockbyCode($code) { $url = "http://hq.sinajs.cn/list=" . $code; $str = sendRequest($url); $str = explode("=", $str); $str[1] = str_replace("\"", "", $str[1]); $str[1] = str_replace(";", "", $str[1]); $str = explode(",", $str[1]); return $str; }
public function index() { $params = array('version' => C('VERSION'), 'release' => C('RELEASE'), 'app' => U('upgrade/index', '', '', '', true)); $info = sendRequest($this->upgrade_site . 'index.php?m=index&a=checkVersion', $params); if ($info) { $this->ajaxReturn($info); } else { $this->ajaxReturn(0, L('CHECK_THE_NEW_VERSION_IS_WRONG'), 0); } }
function updateLevels($baseUrl, $user, $pass, $resultDir) { echo "Fetching...\n"; $resp = sendRequest($baseUrl, $user, $pass, array('mode' => 'export')); foreach ($resp['data'] as $levelName => $levelData) { echo "Saving {$levelName}...\n"; file_put_contents("{$resultDir}/{$levelName}.gd2l", json_encode($levelData)); } echo "Finished\n"; }
function requestAccessToken($content) { $response = sendRequest(OAUTHURL, 'POST', $content); if ($response !== false) { $authToken = json_decode($response); if (!empty($authToken) && !empty($authToken->{ACCESSTOKEN})) { return $authToken; } } return false; }
function send_lms($phone) { global $_gl; global $my_db; $httpmethod = "POST"; $url = "http://api.openapi.io/ppurio/1/sendnumber/list/minivertising"; $clientKey = "MTAyMC0xMzg3MzUwNzE3NTQ3LWNlMTU4OTRiLTc4MGItNDQ4MS05NTg5LTRiNzgwYjM0ODEyYw=="; $contentType = "Content-Type: application/x-www-form-urlencoded"; $response = sendRequest($httpmethod, $url, $clientKey, $contentType, $phone); $json_data = json_decode($response, true); return $json_data; }
function piRequest($code, $method) { global $verbose; // Requires auth checkAuth(); $code["function"] = "/" . str_replace(".", "/", $code["function"]); if ($verbose) { echo $code["function"] . "\n"; } $endpoint = endpointWith($code["function"], $method); if ($endpoint === false) { return json_encode(sendRequest($method, defaultHeader(), $code["arguments"], $code["function"])); //return false; } if ($method != "GET") { $data = formattedParametersWithData($endpoint, $data); } $newPath = fillEndpointPathWithRequirements($endpoint, $code["arguments"]); $code["arguments"] = cleanEndpointRequirementsFromData($endpoint, $code["arguments"]); return json_encode(sendRequest($method, defaultHeader(), $code["arguments"], $newPath)); }
function getListId($baseURL, $userId, $password, $campaignId, $listTitle, $logLevel) { $listId = 0; $curlURL = $baseURL . 'lead/readleadslist/'; $curlData = 'pageNo=1&perPage=1&campaignid=' . $campaignId . '&listTitle=' . urlencode($listTitle); // Send the request to the API server $response = sendRequest($curlURL, 'GET', $userId, $password, $curlData, $logLevel); if ($response != '') { // Managed to send the request. Decode the reply. $responseObject = json_decode($response, TRUE); if ($logLevel >= 2) { echo "getListId: DEBUG - Response to readLeadsList:\n"; print_r($responseObject); } if ($responseObject['resultCode'] === 'success') { // The request was successful, and the requested list was found. Pick up its Id $listId = $responseObject['result']['data'][0]['listId']; } } return $listId; }
function epiSendRequestDebug($host, $url, $request, $port = 80) { error_reporting(E_ALL); $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if ($socket === false) { echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n"; return FALSE; } $address = gethostbyname($host); if (!socket_connect($socket, $address, $port)) { echo socket_strerror(socket_last_error()); return FALSE; } $httpQuery = "POST " . $url . " HTTP/1.0\r\n"; $httpQuery .= "User-Agent: xmlrpc\r\n"; $httpQuery .= "Host: " . $host . "\r\n"; $httpQuery .= "Content-Type: text/xml\r\n"; $httpQuery .= "Content-Length: " . strlen($request) . "\r\n\r\n"; $httpQuery .= $request . "\r\n"; //echo $httpQuery; $httpQuery = utf8_encode($httpQuery); if (!socket_send($socket, $httpQuery, strlen($httpQuery), 0)) { echo socket_strerror(socket_last_error()); return FALSE; } $xmlResponse = ""; $buff = ""; while ($bytes = socket_recv($socket, $buff, 1024, MSG_WAITALL) > 0) { $xmlResponse .= $buff; // echo $buff; } # echo "socket_recv() failed; reason: " . socket_strerror(socket_last_error($socket)) . "\n"; socket_close($socket); $logxmlRequest = xmlrpc_encode_request('log_me', array("response: " . $xmlResponse . ":-)")); sendRequest($rpc_server, '/', $logxmlRequest, $rpc_port); $xmlResponse = substr($xmlResponse, strpos($xmlResponse, "\r\n\r\n") + 4); $xmlResponse = xmlrpc_decode($xmlResponse); // Returns the result. return $xmlResponse; }
function createToken($tokenData){ $res = false; // проверка наличия всех полей foreach(array('IPN_CC_TOKEN', 'CARD_HOLDER_NAME', 'CARD_MASK', 'IPN_INFO', 'IPN_CC_EXP_DATE') as $one) { if(!array_key_exists($one, $tokenData)) die("missing value: " . $one); } $merchant = 'merchant'; $token = $_POST['IPN_CC_TOKEN']; $data = addSign(array('merchant' => $merchant, 'refNo' => $token)); $tokenInfo = json_decode(sendRequest($data), 1); if(isset($tokenInfo['meta']['status']['message']) && $tokenInfo['meta']['status']['message'] == 'success' && isset($tokenInfo['token'])){ $token = $data['token']; // сохранить токен в БД } return $res; }
function search($date, $from_city, $to_city) { //Safar Search Example $url = "http://185.55.225.69/rest/lowfaresearch"; $User = '******'; $Password = '******'; $headers = array('Content-Type: application/xml', 'User: '******'Password: '******'<OTA_AirLowFareSearchRQ xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05 OTA_AirLowFareSearchRQ.xsd" EchoToken="1234" TimeStamp="2015-11-01T12:00:00+03:30" Target="Real" Version="2.001" SequenceNmbr="1" PrimaryLangID="En-us"> <OriginDestinationInformation> <DepartureDateTime>' . $date . '</DepartureDateTime> <OriginLocation LocationCode="' . $from_city . '"/> <DestinationLocation LocationCode="' . $to_city . '"/> </OriginDestinationInformation> </OTA_AirLowFareSearchRQ>'; $content = sendRequest($url, $headers, $req); $xml = new SimpleXMLElement($content); $flights = $xml->PricedItineraries->PricedItinerary->AirItinerary->OriginDestinationOptions->OriginDestinationOption; return $flights; }
<?php require_once 'nusoap.php'; /* Include the common functions to send a SOAP request to SiteCatalyst. */ require_once 'library/SOAPRequest.php'; /* DataSource.BeginDataBlock - sends data to Analytics using a DataSource */ $blockName = 'Adwords Data'; $colNameArray = array('Date', 'Tracking Code', 'Event 84', 'Event 83', 'Event 82'); $rowData = array(array('1/13/2014', 'NA:google:cpl:NA:NA:PS4_AR:NA:NA:NA:NA:NA:NA:NA:NA:NA ', '455', '003456', '89')); /* Set the endOfBlock to 0 to continue appending data. */ $endOfBlock = 0; $params = array('blockName' => $blockName, 'dataSourceID' => 1, 'reportSuiteID' => 'soqdev', 'columnNames' => $colNameArray, 'rows' => $rowData, 'endOfBlock' => $endOfBlock); $result = sendRequest('DataSource.BeginDataBlock', $params); $blockID = $result['blockID']; var_dump($result); sleep(3); /* DataSource.AppendDataBlock - sends data (continued) to Analytics using a DataSource $rowData = array( array('1/11/2011','100300','455','003456'), array('1/12/2011','100301','455','003456') ); */ /* Set the endOfBlock to '' to stop appending data. $endOfBlock=''; $params = array( 'blockID'=>$blockID, 'dataSourceID'=>$dsId, 'reportSuiteID'=>$rsId, 'rows'=>$rowData, 'endOfBlock'=>$endOfBlock );
function getChatHistory($peerid, $convid) { $nonce = 'bibce'; $signature_ts = time(); $str = sprintf('%s:%s:%s:%s:%s', APPID, $peerid, $convid, $nonce, $signature_ts); $signature = sha1sign($str); $param = array('convid' => $convid, 'peerid' => $peerid, 'nonce' => $nonce, 'signature_ts' => $signature_ts, 'signature' => $signature, 'limit' => 10); $url = 'https://leancloud.cn/1.1/rtm/messages/logs?' . http_build_query($param); // $url = 'https://leancloud.cn/1.1/rtm/messages/logs?convid=552119bbe4b043f1c84c0b7a'; $chatHistory = sendRequest($url, 'GET', $param); header("Content-Type: application/json; charset=utf-8"); return json_decode($chatHistory, 1); }
<?php require_once "grab_globals.lib.php"; include "xmlrpc_submit.php"; include "settings.php"; include "utils.php"; // This part send a request for basic information for the regions supported by the current started server ob_start(); $xmlRequest = xmlrpc_encode_request('getStatus', array($_SERVER['SERVER_NAME'], "upload")); $arrayResponse = sendRequest($rpc_server, '/', $xmlRequest, $rpc_port); ob_end_clean(); if ($arrayResponse === "OK") { //header('Content-Type: text/html'); // plain html file } else { //echo "not ok $arrayResponse"; if (strlen(strstr($_SERVER['SERVER_NAME'], 'moebius')) == 0) { $subject = "EpiExplorer XMLRPC Server is not working! (" . date("H:i:s d.m.y") . " , " . anonimizedUser() . ")"; $body = "On " . date("H:i:s d.m.y") . " requested by " . $_SERVER["REMOTE_ADDR"] . " (" . gethostbyaddr($_SERVER["REMOTE_ADDR"]) . "\n" . "Status:'" . $arrayResponse . "'\n" . "More info: \n" . "Server name: " . $_SERVER['SERVER_NAME'] . "\n" . "Request URI: " . $_SERVER['REQUEST_URI'] . "\n" . "Http referer: " . $_SERVER['HTTP_REFERER'] . "\n"; if (mail($contact_email, $subject, $body)) { header('Location: maintenance.php'); } else { header('Location: maintenance.php'); } } else { header('Location: maintenance.php'); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
function send_lms($phone, $gift, $nation) { global $_gl; global $my_db; $httpmethod = "POST"; $url = "http://api.openapi.io/ppurio/1/message/lms/minivertising"; $clientKey = "MTAyMC0xMzg3MzUwNzE3NTQ3LWNlMTU4OTRiLTc4MGItNDQ4MS05NTg5LTRiNzgwYjM0ODEyYw=="; $contentType = "Content-Type: application/x-www-form-urlencoded"; if ($gift == "1") { if ($nation == "1") { $gift_name = "브롬톤 자전거 1대"; $response = sendRequest($httpmethod, $url, $clientKey, $contentType, $phone, $gift_name); }else if ($nation == "2"){ $gift_name = "스타벅스 1년치 이용권(150만원 충전 카드)"; $response = sendRequest5($httpmethod, $url, $clientKey, $contentType, $phone, $gift_name); }else if ($nation == "3"){ $gift_name = "홍콩 왕복 항공권"; $response = sendRequest6($httpmethod, $url, $clientKey, $contentType, $phone, $gift_name); }else if ($nation == "4"){ $gift_name = "TWG 티 세트와 로얄 알버트 찻잔 세트"; $response = sendRequest7($httpmethod, $url, $clientKey, $contentType, $phone, $gift_name); } }else if ($gift == "2"){ $gift_name = "촉촉 여행 선물"; $response = sendRequest3($httpmethod, $url, $clientKey, $contentType, $phone, $gift_name); }else if ($gift == "3"){ $gift_name = "빌리프 여행 선물"; $response = sendRequest4($httpmethod, $url, $clientKey, $contentType, $phone, $gift_name); }else{ $gift_name = "촉촉 3종 체험 키트"; $response = sendRequest2($httpmethod, $url, $clientKey, $contentType, $phone, $gift_name); } $json_data = json_decode($response, true); /* 받아온 결과값을 DB에 저장 및 Variation */ $query3 = "INSERT INTO sms_info(send_phone, send_status, cmid, send_regdate) values('".$phone."','".$json_data['result_code']."','".$json_data['cmid']."','".date("Y-m-d H:i:s")."')"; $result3 = mysqli_query($my_db, $query3); $query2 = "UPDATE member_info SET mb_lms='Y' WHERE mb_phone='".$phone."'"; $result2 = mysqli_query($my_db, $query2); if ($json_data['result_code'] == "200") $flag = "Y"; else $flag = "N"; return $flag; }
public function checkVersion() { $params = array('version' => C('VERSION'), 'release' => C('RELEASE')); $info = sendRequest($this->upgrade_site . 'index.php?m=index&a=checkVersion', $params); if ($info) { $this->ajaxReturn($info); } else { $this->ajaxReturn(0, '检查新版本出错', 0); } }
<?php switch ($_POST['task']) { case 'oauth': $header = oauthAuthHeader(json_decode($_POST['json'])); break; case 'data': break; } echo sendRequest($_POST['url'], $header, $_POST['body'], $_POST['method']); function oauthAuthHeader($json) { $res = "OAuth "; foreach ($json as $key => $value) { $res = $res . $key . "=\"" . $value . "\", "; } return array('Authorization:' . trim($res, ", ")); } function sendRequest($url, $header, $body, $method) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); if ($method == "PUT" || $method == "POST") { curl_setopt($ch, CURLOPT_POSTFIELDS, $body); } $res = curl_exec($ch); curl_close($ch); return $res; }
function constructRequest($phoneNumber) { $baseURL = "www.truecaller.com/in/"; $finalURL = $baseURL . $phoneNumber; return 'http://' . $finalURL; } function sendRequest($phoneNumber) { $requestURL = constructRequest($phoneNumber); $curl = curl_init(); $setUserAgent = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36"; $setCookie = "YOUR FACEBOOK COOKIE"; curl_setopt($curl, CURLOPT_URL, $requestURL); curl_setopt($curl, CURLOPT_USERAGENT, $setUserAgent); curl_setopt($curl, CURLOPT_COOKIE, $setCookie); $result = curl_exec($curl) or die(curl_error($curl)); curl_close($curl); return $result; } function getTextBetweenTags($string, $tagname) { // Create DOM from string $html = str_get_html($string); $titles = array(); // Find all tags foreach ($html->find($tagname) as $element) { $titles[] = $element->plaintext; } } getTextBetweenTags(sendRequest('9772536250'), 'h1');
* * */ $login = ""; $access_token = ""; $user_id = null; // получение ID пользователя $url = "https://api.instagram.com/v1/users/search?q={$login}&access_token={$access_token}"; $resource_decode = sendRequest($url); if ($resource_decode['meta']['code'] != 200) { exit; } $user_id = $resource_decode['data'][0]['id']; // получение списка последних изображений $url_send = "https://api.instagram.com/v1/users/{$user_id}/media/recent/?access_token={$access_token}"; $data_images = sendRequest($url_send); $result_html = render_html($data_images); function sendRequest($url) { $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($curl); curl_close($curl); $resource_decode = json_decode($result, true); return $resource_decode; } function render_html($data) { $result_str = ''; if (count($data['data']) > 0 && $data['meta']['code'] == 200) { $result_str .= '<div id="owl" class="owl-carousel">';
$blockName = 'OfflineRevenueBlock1'; $colNameArray = array('Date', 'Product', 'Event 2', 'transactionID'); $rowData = array(array('01/13/2011', '100302', '455', '003456'), array('01/14/2011', '100303', '455', '003456')); /* Set the endOfBlock to 0 to continue appending data. */ $endOfBlock = '0'; $params = array('blockName' => $blockName, 'dataSourceID' => $dsId, 'reportSuiteID' => $rsId, 'columnNames' => $colNameArray, 'rows' => $rowData, 'endOfBlock' => $endOfBlock); $result = sendRequest('DataSource.BeginDataBlock', $params); $blockID = $result['blockID']; var_dump($result); sleep(3); /* DataSource.AppendDataBlock - sends data (continued) to Omniture using a DataSource */ $rowData = array(array('01/11/2011', '100300', '455', '003456'), array('01/12/2011', '100301', '455', '003456')); /* Set the endOfBlock to ту to stop appending data. */ $endOfBlock = ''; $params = array('blockID' => $blockID, 'dataSourceID' => $dsId, 'reportSuiteID' => $rsId, 'rows' => $rowData, 'endOfBlock' => $endOfBlock); $result = sendRequest('DataSource.AppendDataBlock', $params); var_dump($result); sleep(3); } catch (Exception $e) { echo $e . "\n"; } /* Additional Data Sources Methods */ try { /* DataSource.Restart */ /* $params = array( 'dataSourceID'=>$dsId, 'reportSuiteID'=>$rsId ); $status = sendRequest('DataSource.Restart', $params ); var_dump($status);
<?php require_once '../connection/connection.php'; require_once 'globalSettings.conf.php'; require_once 'publicFunctions.func.php'; session_start(); $request = []; $action = []; function analyseAddress() { global $action, $request; $action = split('/', split('\\?', substr($_SERVER['REQUEST_URI'], 5))[0]); $request = json_decode(file_get_contents('php://input', 'r'), true); } function sendRequest() { global $action; if (count($action) !== 2 || $action[0] === '' || $action[1] === '') { handle(ERROR_INPUT . '00' . 'Request Error.'); } $requestFile = $action[0] . '.request.php'; if (file_exists($requestFile)) { include $requestFile; } else { handle(ERROR_INPUT . '01' . 'Request Error.'); } } analyseAddress(); sendRequest();
} doAction('cron_1'); if (SYSTEM_PAGE == 'runcron') { $cron = isset($_GET['cron']) ? sqladds(strip_tags($_GET['cron'])) : msg('运行失败:计划任务未指定'); $cpw = option::get('cron_pw'); $x = $m->once_fetch_array("SELECT * FROM `" . DB_PREFIX . "cron` WHERE `name` = '{$cron}';"); if (empty($x['id'])) { msg('运行失败:此计划任务不存在'); } $log = cron::run($x['file'], $x['name']); if ($x['freq'] == '-1') { cron::del($x['name']); } else { cron::aset($x['name'], array('lastdo' => time(), 'log' => $log)); } } else { $sign_multith = option::get('sign_multith'); if (!isset($_GET['donnot_sign_multith']) && !empty($sign_multith) && function_exists('fsockopen')) { for ($ii = 0; $ii < $sign_multith; $ii++) { sendRequest(SYSTEM_URL . 'do.php?donnot_sign_multith&in_thread&pw=' . $cron_pw); } } $return = ''; if (option::get('cron_last_do_time') != $today) { option::set('cron_last_do_time', $today); option::set('cron_last_do', '0'); } cron::runall(); } doAction('cron_2'); msg('本次计划任务完成', false, false);
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="index.php">HITHOT</a> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> <li class="dropdown dropdown-large"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Categorias <b class="caret"></b></a> <ul class="dropdown-menu dropdown-menu-large row"> <?php $response = sendRequest('redtube.Categories.getCategoriesList'); if ($response) { $json = json_decode($response, true); $categories = $json['categories']; foreach ($categories as $category) { echo "\r\n <li class=\"col-sm-3\">\r\n <ul>\r\n <li><a href=\"#\">" . $category['category'] . "</a></li>\r\n <li class = \"divider\"></li>\r\n </ul>\r\n </li>"; } } ?> <li><a href="categorias.php" class="text-center text-warning">Ver todas las categorias</a></li> </ul> </li> <li><a href="function3.php">Actrices</a></li> <li><a href="function2.php">Prueba</a></li> <li class="dropdown">
if ($result == 'No Friend Found') { } else { $content['Friends'] = $result; echo json_encode($content); } } else { if ($reason == "Send Request") { if (isset($_POST['reason'])) { $memberID = $_POST['MID']; $myID = $_POST['UID']; } else { $memberID = $_GET['MID']; $myID = $_GET['UID']; } cancelRequest($myID, $memberID); $result = sendRequest($myID, $memberID); if ($result == 'Request Sent') { ///getUserDeviceIDs($userID,$ignore="-1") $devotionDetails = array(); $devotionDetails = getUserDetails($myID, $memberID); //$churchID= getchurch($cid); $deviceIDs = getUserDeviceIDs($memberID, $myID); if (count($deviceIDs) >= 1) { $message = array(); $val = array(); $i = 0; $val[$i] = $deviceIDs; $message = array(); $message['data-head'] = $devotionID; $username = $devotionDetails['name']; $message['alert'] = " Connection Request from " . $username;
$res = json_decode(sendRequest(array('data' => json_encode($json))), true); if (isset($res['success'])) { echo "added links"; $success++; } else { echo "<h2>ERROR: " . json_encode($res, true) . "</h2>"; $error++; } echo "<br />"; ////////////////////////////////////// /////// CHECK LINKS echo "<h3>checking links</h3>"; echo "checking 8 links for {$username}"; echo "<br />"; $json = array('username' => $username, 'auth' => $authcode, 'dev' => "API test script", 'device' => "API device", 'mode' => "read", 'links' => array(array('id' => $links[0]), array('id' => $links[1]), array('id' => $links[2]), array('id' => $links[3]), array('id' => $links[4]), array('id' => genrand()), array('id' => genrand()), array('id' => genrand()))); $res = json_decode(sendRequest(array('data' => json_encode($json))), true); if (isset($res)) { $worked = true; $count = 0; if (count($res) != 5) { echo "<h2>ERROR: incorrect number of links found " . json_encode($res, true) . "</h2>"; $error++; } else { echo count($res) . " links found. "; foreach ($res as $r) { if ($links[0] == $r['id'] && $r['lastvisit'] > 0 && $r['commentvisit'] < 1) { $count++; } if ($links[1] == $r['id'] && $r['lastvisit'] < 1 && $r['commentvisit'] > 0 && $r['comments'] == "123") { $count++; }
// Preparing XML request // Main fields $req = new SimpleXMLElement('<?xml version="1.0"?><query></query>'); $req->addChild('userid', MY_ID); $req->addChild('userkey', MY_KEY); $req->addChild('action', 'AddMedia'); $req->addChild('source', $_POST['source']); $formatNode = $req->addChild('format'); // Format fields foreach ($_POST['format'] as $property => $value) { if ($value !== '') { $formatNode->addChild($property, $value); } } // Sending API request $res = sendRequest($req->asXML()); try { // Creating new object from response XML $response = new SimpleXMLElement($res); // If there are any errors, set error message if (isset($response->errors[0]->error[0])) { $error = $response->errors[0]->error[0] . ''; } else { if ($response->message[0]) { // If message received, set OK message $message = $response->message[0] . ''; } } } catch (Exception $e) { // If wrong XML response received $error = $e->getMessage();
break; case "send_sms": $phone = $_REQUEST['phone']; $phone_arr = explode("-", $phone); $cel = $phone_arr[0] . $phone_arr[1] . $phone_arr[2]; /* $httpmethod = "POST"; $url = "http://api.openapi.io/ppurio_test/1/message_test/lms/minivertising"; $clientKey = "MS0xMzY1NjY2MTAyNDk0LTA2MWE4ZDgyLTZhZmMtNGU5OS05YThkLTgyNmFmYzVlOTkzZQ=="; $contentType = "Content-Type: application/x-www-form-urlencoded"; */ $httpmethod = "POST"; $url = "http://api.openapi.io/ppurio/1/message/lms/minivertising"; $clientKey = "MTAyMC0xMzg3MzUwNzE3NTQ3LWNlMTU4OTRiLTc4MGItNDQ4MS05NTg5LTRiNzgwYjM0ODEyYw=="; $contentType = "Content-Type: application/x-www-form-urlencoded"; $response = sendRequest($httpmethod, $url, $parameters, $clientKey, $contentType, $phone); //echo("<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />"); $json_data = json_decode($response, true); //print_r($json_data); /* 받아온 결과값을 DB에 저장 및 Variation */ $query = "INSERT INTO " . $_gl['sms_info_table'] . "(send_phone, send_status, cmid, send_regdate) values('" . $phone . "','" . $json_data['result_code'] . "','" . $json_data['cmid'] . "','" . date("Y-m-d H:i:s") . "')"; $result = mysqli_query($my_db, $query); $query2 = "UPDATE " . $_gl['member_info_table'] . " SET mb_lms='Y' WHERE mb_phone='" . $phone . "'"; $result2 = mysqli_query($my_db, $query2); $flag = "N"; if ($result) { echo $flag = "Y"; } else { echo $flag = "N";
<?php require_once $_SERVER['DOCUMENT_ROOT'] . 'cloud/models/requests/index.php'; $inputArr = $_REQUEST; $resp = sendRequest($inputArr); echo json_encode($resp); $mailer = file_get_contents('http://travcork-maybe588.rhcloud.com/cloud/models/email/emailer.php?email=' . $inputArr['email']); //echo($mailer);
$baseString = buildBaseString($baseURI, $oauth); //build the base string $compositeKey = getCompositeKey($consumerSecret, null); //first request, no request token yet $oauth_signature = base64_encode(hash_hmac('sha1', $baseString, $compositeKey, true)); //sign the base string $oauth['oauth_signature'] = $oauth_signature; //add the signature to our oauth array /*echo "<pre>"; print_r($oauth); echo "</pre>"; echo "<pre>"; print_r($baseURI); echo "</pre>";*/ $response = sendRequest($oauth, $baseURI); //make the call //parse response into associative array $responseArray = array(); $parts = explode('&', $response); foreach ($parts as $p) { $p = explode('=', $p); $responseArray[$p[0]] = $p[1]; } //end foreach //get oauth_token from response $oauth_token = $responseArray['oauth_token']; //redirect for authorization header("Location: http://api.twitter.com/oauth/authorize?oauth_token={$oauth_token}"); ?>
/** * 异步执行计划任务(伪) * @param string $name 计划任务名称 */ public static function arun($name) { $url = SYSTEM_URL . 'do.php?mod=runcron&cron=' . $name; $cpw = option::get('cron_pw'); if (!empty($cpw)) { $url .= '&pw=' . $cpw; } if (!sendRequest($url)) { self::aset($name, array('log' => '[' . date('Y-m-d H:m:s') . ']计划任务启动失败,在调用 fsockopen() 时失败,请检查主机是否支持此函数')); } }