示例#1
0
function wp_spacestatus_api_url_string()
{
    $options = get_option('wp_spacestatus_options');
    echo "<input id='wp_spacestatus_api_url_string' name='wp_spacestatus_options[api_url_string]' size='80' type='text' value='{$options['api_url_string']}' />";
    $rsp = callAPI($options['api_url_string']);
    if (!is_wp_error($rsp)) {
        echo " <span style=\"padding: 3px 5px; display: inline-block; background-color: rgba(150, 255, 150, 1); border: 1px solid rgba(0, 220, 0, 1);\">v" . $rsp->getAPIVersion() . "</span>";
    } else {
        echo " <span style=\"padding: 3px 5px; display: inline-block; background-color: rgba(255, 150, 150, 1); border: 1px solid rgba(220, 0, 0, 1);\">Failed!</span>";
    }
}
示例#2
0
<?php

require_once 'includes.php';
$api_brands_url = "https://laudsocialdev.azurewebsites.net/Test/GetBrands";
$brands_json = callAPI("GET", $api_brands_url);
if ($brands_json) {
    $brands = json_decode($brands_json);
}
$count = 0;
//echo "<pre>";
?>
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>Brands Display Page</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
        <link rel="stylesheet" href="style.css">
       

        <!-- Optional theme -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">

        <!-- Latest compiled and minified JavaScript -->
示例#3
0
function updateClientCreditBalance($userId)
{
    logActivityGlobal("Updating client {$userId}");
    $clientCredit = 0;
    $postfields["action"] = "getcredits";
    $postfields["clientid"] = $userId;
    $clientData = callAPI($postfields);
    if ($clientData['result'] == "success") {
        foreach ($clientData['credits'] as $creditArr) {
            //Make one dimentsional two dimentsional
            if (!is_array($creditArr[0])) {
                $creditArr = array($creditArr);
            }
            foreach ($creditArr as $credit) {
                $clientCredit += $credit['amount'];
            }
        }
        logActivityGlobal("Updating client {$userId} with credit: {$clientCredit}");
        $postfields["action"] = "updateclient";
        $postfields["clientid"] = $userId;
        $postfields["credit"] = $clientCredit;
        $results = callAPI($postfields);
        if ($clientData['result'] == "success") {
            logActivityGlobal("Successfully updated client credit.");
        } else {
            logActivityGlobal("Error updating client credit.");
        }
    }
}
function lastchange_shortcode($atts)
{
    global $response;
    $options = get_option('wp_spacestatus_options');
    if ($response === null) {
        $response = callAPI($options['api_url_string']);
    }
    date_default_timezone_set(get_option('timezone_string'));
    return strftime($options['lastchange_date_format'], $response->getLastChange());
}
function initiateTxnRefund($requestParamList)
{
    $CHECKSUM = getChecksumFromArray($requestParamList, PAYTM_MERCHANT_KEY, 0);
    $requestParamList["CHECKSUM"] = $CHECKSUM;
    return callAPI(PAYTM_REFUND_URL, $requestParamList);
}
示例#6
0
            }
    }
    // Optional Authentication:
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_URL, $url);
    if ($headers) {
        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    }
    $result = curl_exec($curl);
    $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    curl_close($curl);
    return $result;
}
// Send request to API with client params
if (isset($_POST['lat']) && isset($_POST['lng'])) {
    $lat = $_POST['lat'];
    $lng = $_POST['lng'];
    $data = array("lat" => $lat, "lon" => $lng);
    $headers = array('Accept: application/json', 'X-VERSION: 2', 'X-API-KEY: 46f06ed1-0124-4edc-9283-0df69a604ef4');
    $res = callAPI("GET", "https://api.opendatataxi.fr/taxis/", $headers, $data);
    $object = json_decode($res);
    $taxisList = array();
    foreach ($object->data as $key => $value) {
        $taxi = new Taxi($value);
        array_push($taxisList, $taxi);
    }
    echo json_encode($taxisList);
}
示例#7
0
文件: fb.php 项目: samundrak/MixFeeds
{
    $ch = curl_init($link);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $v = curl_exec($ch);
    curl_close($ch);
    return $v;
}
Route::get('/fb', function () {
    // $token = callAPI('https://graph.facebook.com/oauth/access_token?client_id=972492646144125&client_secret=7d2f6140e9766d924c1721c7ac1be01f&grant_type=client_credentials');
    $pages = array('ncell', 'memeNEPALofficial', 'TrollCric8');
    $token = '972492646144125|-Sp32_5WglLEiG-Ha4eZTmB3kvg';
    substr(strchr($token, "="), 1);
    $allposts = [];
    $onlyposts = [];
    foreach ($pages as $key => $pageName) {
        $tmp = callAPI('https://graph.facebook.com/v2.5/' . $pageName . '/posts?limit=5&fields=picture%2Cchild_attachments%2Ccaption%2Ccreated_time%2Cdescription%2Cmessage&access_token=' . $token);
        $tmp = json_decode($tmp, true);
        array_push($allposts, $tmp);
        foreach ($tmp as $key => $value) {
            foreach ($value as $key => $value) {
                if (is_array($value)) {
                    $value['pagename'] = $pageName;
                    array_push($onlyposts, $value);
                }
            }
        }
    }
    shuffle($onlyposts);
    foreach ($onlyposts as $key => $value) {
        echo 'Page Name: ' . $value['pagename'] . '<br/>';
        echo 'Title: ' . $value['message'] . '<br/>';
示例#8
0
<?php

require_once 'includes.php';
if (isset($_GET['brandId']) && !empty($_GET['brandId'])) {
    $api_url = "https://laudsocialdev.azurewebsites.net/Test/GetPosts?brandId=" . $_GET['brandId'];
} else {
    header("Location: index.php");
}
$result_json = callAPI("GET", $api_url);
if ($result_json) {
    $brands = json_decode($result_json);
} else {
    die("Problem with API. Please check.");
}
$count = 0;
//echo "<pre>";
//print_r($brands);
?>
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>Brands Detail Page</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
示例#9
0
    switch ($method) {
        case "POST":
            curl_setopt($curl, CURLOPT_POST, 1);
            if ($data) {
                curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
            }
            break;
        case "PUT":
            curl_setopt($curl, CURLOPT_PUT, 1);
            break;
        case "DELETE":
            curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
            break;
        default:
            if ($data) {
                $url = sprintf("%s%s?%s", $base, $path, http_build_query($data));
            }
    }
    print "calling " . $url . "\n";
    #curl_setopt($curl, CURLOPT_VERBOSE, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, getHeaders($method, $path));
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    return curl_exec($curl);
}
print callAPI("GET", "http://localhost:9669", "/1/create/views/items") . "\n";
print callAPI("GET", "http://localhost:9669", "/1/update/views/theitem") . "\n";
print callAPI("GET", "http://localhost:9669", "/1/query/views", array('count' => 10)) . "\n";
print callAPI("DELETE", "http://localhost:9669", "/1/clear/views") . "\n";
print callAPI("DELETE", "http://localhost:9669", "/1/delete/views") . "\n";