Ejemplo n.º 1
0
 public function __construct(array $options = array())
 {
     if (!isset($options['default_cache_config'])) {
         $options['default_cache_config'] = 'cache/aws';
     }
     if (!isset($options['key']) && Kwf_Config::getValue('aws.key')) {
         $options['key'] = Kwf_Config::getValue('aws.key');
     }
     if (!isset($options['secret']) && Kwf_Config::getValue('aws.secret')) {
         $options['secret'] = Kwf_Config::getValue('aws.secret');
     }
     parent::__construct($options);
 }
Ejemplo n.º 2
0
 static function Register()
 {
     foreach ($_POST as $key => $value) {
         $post_vars[str_replace('newVisitor_', 'newVisitor.', $key)] = $_POST[$key];
     }
     if (defined('ZPRESS_API') && ZPRESS_API != '') {
         if (SNS_ARN_CONTACT_REQUEST != '') {
             $name = $post_vars['name'];
             $name_split = preg_split('/[\\s]+/', $post_vars['name'], 2, PREG_SPLIT_NO_EMPTY);
             // call sns to send the contact to Zillow.com
             $sns = new AmazonSNS(defined(AWS_KEY) ? array('certificate_authority' => true, 'key' => AWS_KEY, 'secret' => AWS_SECRET_KEY) : array('certificate_authority' => true));
             $sns->publish(SNS_ARN_CONTACT_REQUEST, json_encode((object) array('ContactDate' => gmdate('Y-m-d\\TH:i:s.uP'), 'Email' => $post_vars['newVisitor.Email'], 'FirstName' => $post_vars['newVisitor.FirstName'], 'LastName' => $post_vars['newVisitor.LastName'], 'Message' => 'Registered new IDX account', 'Phone' => $post_vars['newVisitor.PhoneNumber'], 'Zuid' => get_option('zuid'), 'ListingUrl' => @$post_vars['newVisitor.ListingUrl'], 'Uid' => md5(uniqid()), 'optIn' => $post_vars['optIn'], 'isOptIn' => $post_vars['isOptIn'])));
         }
         $post_vars["skipThirdParty"] = 'true';
     }
     $apiHttpResponse = dsSearchAgent_ApiRequest::FetchData("Register", $post_vars, false, 0);
     $response = json_decode($apiHttpResponse["body"]);
     if ($response->Success) {
         $remember = @$_POST["remember"] == "on" ? time() + 60 * 60 * 24 * 30 : 0;
         setcookie('dsidx-visitor-public-id', $response->Visitor->PublicID, $remember, '/');
         setcookie('dsidx-visitor-auth', $response->Visitor->Auth, $remember, '/');
     }
     header('Content-Type: application/json');
     echo $apiHttpResponse["body"];
     die;
 }
Ejemplo n.º 3
0
if ($CustomerID < 1) {
    if ($AccountStatus >= 200) {
        $_SESSION['amazon-login-error'] = "Account is frozen";
    } else {
        $_SESSION['amazon-login-error'] = "login failed";
    }
    header("location: amazon-login.php");
    exit;
}
$AccountName = $member["AccountName"];
// create SNS response to amazon
$linkAddr[0] = array('Address' => (string) $CustomerID, 'AddressDescription' => $AccountName);
$linkAns = array('Type' => 'LinkAccount', 'RequestToken' => $requestId, 'AccountToken' => (string) $CustomerID, 'Kind' => 'LOGIN', 'Addresses' => $linkAddr);
$linkJson = json_encode($linkAns);
// create SNS client and disable SSL verification.
$sns = new AmazonSNS();
$sns->ssl_verification = false;
$resp = $sns->publish($AMAZON_ARN, $linkJson);
if (!$resp->isOK()) {
    echo "There was a error communicating with Amazon, please try again later";
    exit;
}
if (false) {
    // some debug stuff
    echo "SNS Sent:<br>";
    echo "{$linkJson}";
    echo "<br>";
    echo "<br>";
    echo "Response body:<br>";
    var_dump($resp->body);
    echo "<br>";
<?php

require_once '/usr/share/php/AWSSDKforPHP/sdk.class.php';
define('AWS_KEY', 'AKIAIGKECZXA7AEIJLMQ');
define('AWS_SECRET_KEY', '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');
$sns = new AmazonSNS();
$sns->set_region($sns::REGION_EU_W1);
$topic = md5('jurg@9apps.net/status');
$response = $sns->create_topic($topic);
$response->isOK() or die('could not create topic ' + $topic);
pr($response->body);
function pr($var)
{
    print '<pre>';
    print_r($var);
    print '</pre>';
}
Ejemplo n.º 5
0
<?php

require_once '/usr/share/php/AWSSDKforPHP/sdk.class.php';
define('AWS_KEY', 'AKIAIGKECZXA7AEIJLMQ');
define('AWS_SECRET_KEY', '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');
$sns = new AmazonSNS();
$sns->set_region($sns::REGION_EU_W1);
$topics = $sns->list_topics();
$topics->isOK() or die('could not list topics');
pr($topics->body);
function pr($var)
{
    print '<pre>';
    print_r($var);
    print '</pre>';
}
Ejemplo n.º 6
0
<?php

require_once '/usr/share/php/AWSSDKforPHP/sdk.class.php';
define('AWS_KEY', 'AKIAIGKECZXA7AEIJLMQ');
define('AWS_SECRET_KEY', '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');
$sns = new AmazonSNS();
$sns->set_region($sns::REGION_EU_W1);
$topic = md5('jurg@9apps.net/status');
$response = $sns->create_topic($topic);
$response->isOK() or die('could not create topic ' + $topic);
$response = $sns->subscribe((string) $response->body->TopicArn(0), 'http', 'http://ec2-184-72-67-235.compute-1.amazonaws.com/sns/receive.php');
pr($response->body);
function pr($var)
{
    print '<pre>';
    print_r($var);
    print '</pre>';
}
<?php

require_once '/usr/share/php/AWSSDKforPHP/sdk.class.php';
define('AWS_KEY', 'AKIAIGKECZXA7AEIJLMQ');
define('AWS_SECRET_KEY', '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');
$sns = new AmazonSNS();
$sns->set_region($sns::REGION_EU_W1);
$topic = md5('jurg@9apps.net/status');
$response = $sns->create_topic($topic);
$response->isOK() or die('could not create topic ' + $topic);
$response = $sns->delete_topic((string) $response->body->TopicArn(0));
pr($response->body);
function pr($var)
{
    print '<pre>';
    print_r($var);
    print '</pre>';
}
Ejemplo n.º 8
0
<?php

require_once '/usr/share/php/AWSSDKforPHP/sdk.class.php';
define('AWS_KEY', 'AKIAIGKECZXA7AEIJLMQ');
define('AWS_SECRET_KEY', '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');
$sns = new AmazonSNS();
$sns->set_region($sns::REGION_EU_W1);
# we only want a POST, before we get the raw input (as json)
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $json = trim(file_get_contents('php://input'));
    $notification = json_decode($json);
    # do we have a message? or do we need to confirm?
    if ($notification->{'Type'} === 'Notification') {
        $message = json_decode($notification->{'Message'});
        # and now we can act on the message
        # ...
    } else {
        if ($notification->{'Type'} === 'SubscriptionConfirmation') {
            $response = $sns->confirm_subscription($notification->{'TopicArn'}, $notification->{'Token'});
            $response->isOK() or die("could not confirm subscription for topic 'status'");
        }
    }
}
Ejemplo n.º 9
0
<?php

require_once '/usr/share/php/AWSSDKforPHP/sdk.class.php';
define('AWS_KEY', 'AKIAIGKECZXA7AEIJLMQ');
define('AWS_SECRET_KEY', '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');
$sns = new AmazonSNS();
$sns->set_region($sns::REGION_EU_W1);
$topic = md5('jurg@9apps.net/status');
$job = "457964863276";
$response = $sns->create_topic($topic);
$response->isOK() or die('could not create topic ' + $topic);
$response = $sns->publish((string) $response->body->TopicArn(0), json_encode(array("job" => $job, "result" => "200", "message" => "Job {$job} finished")));
pr($response->body);
function pr($var)
{
    print '<pre>';
    print_r($var);
    print '</pre>';
}