public function test_pass()
 {
     $ms_key = CONSUMER_KEY;
     $ms_secret = CONSUMER_SECRET;
     $token = OAUTH_TOKEN;
     $secret = OAUTH_SECRET;
     $ms = new MySpace($ms_key, $ms_secret, $token, $secret);
     $userId = $ms->getCurrentUserId();
     $notification = $ms->sendNotification($userId, $userId, array('content' => 'this is  content'), 'http://opensocial.myspace.com/roa/09/mediaitemcomments/');
     $this->assertTrue($notification->statusLink != NULL, "Send Notification Failed");
 }
Beispiel #2
0
//print "<br>Req = " . $req;
$sigMethod = new OAuthSignatureMethod_HMAC_SHA1();
$consumer = new OAuthConsumer($ms_key, $ms_secret);
$signature = $sigMethod->build_signature($req, $consumer);
print "<br>Base string = " . $req . base_string;
print "<br>Built Signature = " . $signature . "";
print "<br>Passed in Signature = " . $_GET['oauth_signature'] . "<br>";
if (strcmp($_GET['oauth_signature'], $signature) != 0) {
    print "Signatures don't match!  Exiting.<br>";
} else {
    print "Signatures match!";
    // Send notification
    $userId = @$_GET['opensocial_viewer_id'];
    $ms = new MySpace($ms_key, $ms_secret, null, null, false);
    $templateParameters = array('content' => 'Test notification content from php sdk', 'button0_surface' => 'canvas', 'button0_label' => 'Go To App Canvas', 'button1_surface' => 'appProfile', 'button1_label' => 'Go To App Profile');
    $rc = $ms->sendNotification('129910', '454304609,28568917', $templateParameters, 'http://api.myspace.com/v1/users/296768296');
    echo '<br><br>sendNotification returned ' . $rc;
    $profileInfo = $ms->getProfile($userId);
    displayProfileInfo($profileInfo);
    $albumInfo = $ms->getAlbumInfo($userId, "817520");
    displayAlbumInfo($albumInfo);
    $appData = $ms->getGlobalAppData();
    displayObject($appData, "appData");
    $ms->putGlobalAppData(array('animal' => 'giraffe', 'plant' => 'rose', 'mineral' => 'sandstone'));
    sleep(3);
    $appData = $ms->getGlobalAppData();
    displayObject($appData, "appData");
    $appData = $ms->getGlobalAppData('animal;plant');
    displayObject($appData, "appData for only animal and plant");
    $ms->clearGlobalAppData('animal;mineral');
    sleep(3);