예제 #1
0
        $_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>";
    echo "<br>Response header:<br>";
    var_dump($resp->header);
예제 #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;
 }
예제 #3
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>';
}