Beispiel #1
0
<?php

include '../../imports/ChromePhp.php';
if (isset($_POST['func']) && !empty($_POST['func'])) {
    $func = $_POST['func'];
    $pid = $_POST['pid'];
    switch ($func) {
        case 1:
            GetNotifications($pid);
            break;
    }
}
function GetNotifications($person_id)
{
    try {
        $notifications = array();
        // Setup connection
        $DB = new PDO("mysql:host=ec2-52-33-118-140.us-west-2.compute.amazonaws.com;dbname=LU", 'Signum', 'signumDB4');
        $DB->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        // Prepare query
        $query = "SELECT * FROM LU.grades WHERE `idusers` = '{$person_id}' AND `date_entered` >= DATE_SUB(CURDATE(), INTERVAL 10 DAY)";
        $statement = $DB->prepare($query);
        $statement->bindParam(1, $person_id);
        $statement->execute();
        $result = $statement->fetchAll(PDO::FETCH_ASSOC);
        foreach ($result as $row) {
            $score = $row['score'];
            $notifications[] = array('score' => $score);
        }
        echo json_encode($notifications);
    } catch (PDOException $e) {
Beispiel #2
0
use BingAds\Notification\GetNotificationsRequest;
// Disable WSDL caching.
ini_set("soap.wsdl_cache_enabled", "0");
ini_set("soap.wsdl_cache_ttl", "0");
// Specify your credentials.
$UserName = "******";
$Password = "******";
$DeveloperToken = "<DeveloperTokenGoesHere>";
// Notification WSDL
$wsdl = "https://sharedservices.adcenterapi.microsoft.com/Api/Notification/v8/NotificationService.svc?wsdl";
try {
    $proxy = new ClientProxy($UserName, $Password, $DeveloperToken, $wsdl);
    // Given the user credentials provided above, retrieve up to 10 CreditCardPendingExpiration and DepletedBudget
    // notifications not yet retrieved.
    $notificationTypes = NotificationType::CreditCardPendingExpiration . " " . NotificationType::DepletedBudget;
    $notifications = GetNotifications($notificationTypes, 10, $proxy);
    if (empty($notifications->Notification)) {
        print "There are not any new notifications of the specified type or types.\n";
    } else {
        foreach ($notifications as $notification) {
            if (!is_null($notification)) {
                printf("Notification Id: %d", $notification->NotificationId);
                printf("Notification Date: %s", $notification->NotificationDate);
                printf("Notification Type: %s", $notification->NotificationType);
            }
            print "\n";
        }
    }
} catch (SoapFault $e) {
    print $e->getMessage() . "\n\n";
} catch (Exception $e) {