Welcome Developers!

in

Welcome!

in

managing subscriptions with OAuth

Last post 09-07-2010 1:28 PM by Joel. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 08-10-2010 11:36 PM

    • Shobin
    • Not Ranked
    • Joined on 07-27-2010
    • Posts 6

    managing subscriptions with OAuth

     HI,

     I need to View (GET) one or all of  subscriptions of events in the myspace for a user.

     I have gone through the OAuth but I cant find the result. I need a complete example to do this.

     Please help .

     Thanks in advance.

  • 08-10-2010 11:39 PM In reply to

    • Shobin
    • Not Ranked
    • Joined on 07-27-2010
    • Posts 6

    Re: managing subscriptions with OAuth

     Hi,

     I need a php example for getting the subscriptions details for events.

  • 08-12-2010 11:14 PM In reply to

    • Shobin
    • Not Ranked
    • Joined on 07-27-2010
    • Posts 6

    Re: managing subscriptions with OAuth

     Hi

     I am getting the following output when trying to create a subscription:

     Here is the example I am using:

     

    <?php
    require_once("OAuth.php");


    $key = "{key}";
    $secret = "{secret key}";
    $hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
    $protocol = "http";
    $domain = "api.myspace.com";
    $base = "/stream/subscription";
    $base_url = "$protocol://$domain$base";
    $action = 'POST';
    $formParams = array("" => '{"Subscription" : { "Type" : "All", "Endpoint" : "http://maketrouble.net/myspacenew/test.php", "Rate" : 1, "Format" : "application/atom+xml", }} ');

    $test_consumer = new OAuthConsumer($key, $secret, NULL);
    $defaults = array("oauth_version" => OAuthRequest::$version,
                          "oauth_nonce" => md5(microtime() . mt_rand()),
                          "oauth_timestamp" => time(),
                          "oauth_consumer_key" => $test_consumer->key);
                         
    $formParams = array_merge($defaults, $formParams);
    $req_req = new OAuthRequest($action, $base_url, $formParams);
    $status = $req_req->sign_request($hmac_method, $test_consumer, NULL);
    print_r($req_req);

    $ch = curl_init($base_url);
    $fp = fopen("streamSubscription.txt", "w");

    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Length: ' . strlen($req_req->to_postdata())));
    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $req_req->to_postdata());
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_HEADER, TRUE);

    curl_exec($ch);
    curl_close($ch);
    fclose($fp);
    ?> 

     

    But I got 409 error:

     

    HTTP/1.1 409 Conflict
    Content-Type: text/html
    Server: Microsoft-IIS/7.5
    X-Server: 10b9572a087c7f2a64b539f9df61e94a7c4e27f31b6ceffe
    Date: Fri, 13 Aug 2010 06:02:49 GMT
    Content-Length: 69

    {"statusCode":"409","statusDescription":"Unexpected error occurred."}

     

    What to do for creating a subscription?

     

    Please help anybody.

     

     

  • 08-16-2010 4:26 PM In reply to

    Re: managing subscriptions with OAuth

     Please send a Wireshark pcap of this to developerrelations@myspace-inc.com. Is this app a MyspaceID app or an onsite app? Only MyspaceID apps can create subscriptions.

     

    thanks,

    Joel

  • 08-27-2010 2:44 AM In reply to

    • Shobin
    • Not Ranked
    • Joined on 07-27-2010
    • Posts 6

    Re: managing subscriptions with OAuth

     Hi,

    I have sent the wireshark pcap and I have not get any reply till now.


    Please help me as soon as possible.

    Thanks and Regards.

  • 08-30-2010 2:54 PM In reply to

    Re: managing subscriptions with OAuth

    Have you not received an email response yet?

     

    thanks,

    Joel

  • 09-02-2010 5:54 AM In reply to

    • Shobin
    • Not Ranked
    • Joined on 07-27-2010
    • Posts 6

    Re: managing subscriptions with OAuth

     I got email response.


    I used python language to create subscription and I successfully created that.

    Now I am stuck with one thing.

    How can I get the activity data using this subscription?

    how to process the pushed data in the end point?

    Please help me .

  • 09-02-2010 12:39 PM In reply to

    Re: managing subscriptions with OAuth

    Hi,

    We have docs discussing the formatting of the stream data. It is up to you to parse this data and incorporate into your db/records as you see fit. The stream data conforms to the activitystrea.ms format. Please read about it here: http://wiki.activitystrea.ms/

     

    Let me know if you have questions.

     

    thanks,

    Joel

  • 09-06-2010 10:38 PM In reply to

    • Shobin
    • Not Ranked
    • Joined on 07-27-2010
    • Posts 6

    Re: managing subscriptions with OAuth

     Hi,

     Thanks for your reply.

    I have created the subscription using python script and I mentioned the subscription end point as a php file.So the activity streams are coming to the end point. I need to parse the data coming to that php file and to store into the database. I need a simple php code to understand the stream data fetching. If you can provide it will be very helpful to me.

     Hope you can reply me as early as possible.

     Waiting for your reply.

  • 09-07-2010 1:28 PM In reply to

    Re: managing subscriptions with OAuth

     I don't have any such sample code, unfortunately. Here is an introduction to the subject here:

    http://www.kirupa.com/web/xml_php_parse_beginner.htm

     

    And this might be a better resource: http://php.net/manual/en/book.xml.php

     

     

    thanks,

    Joel

Page 1 of 1 (10 items)