本文整理汇总了PHP中sendRequest函数的典型用法代码示例。如果您正苦于以下问题:PHP sendRequest函数的具体用法?PHP sendRequest怎么用?PHP sendRequest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendRequest函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_lms
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;
}
示例2: getStockbyCode
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;
}
示例3: index
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);
}
}
示例4: updateLevels
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";
}
示例5: requestAccessToken
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;
}
示例6: send_lms
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;
}
示例7: piRequest
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));
}
示例8: getListId
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;
}
示例9: epiSendRequestDebug
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;
}
示例10: createToken
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;
}
示例11: search
function search($date, $from_city, $to_city)
{
//Safar Search Example
$url = "http://185.55.225.69/rest/lowfaresearch";
$User = 'arad';
$Password = '123456';
$headers = array('Content-Type: application/xml', 'User: ' . $User, 'Password: ' . $Password);
$req = '<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;
}
示例12: array
<?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
);
示例13: getChatHistory
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);
}
示例14: ob_start
<?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>
示例15: send_lms
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;
}