// Ning network subdomain (ie. 'apiexample' in apiexample.ning.com)
public $subdomain = '';
// Ning user email address
protected $email = '';
// Ning user password
protected $password = '';
// Consumer key found at [subdomain].ning.com/main/extend/keys
protected $consumerKey = '';
// Consumer secret found at [subdomain].ning.com/main/extend/keys
protected $consumerSecret = '';
$ningApi = new NingApi();
$ningApi->setSubdomain(‘apiexample’);
$ningApi->login(‘email’,’password’);
$ningApi->setConsumerTokens(‘consumerKey’,’consumerSecret’);
$ningApi->activityItem
$ningApi->blogPost
$ningApi->broadcastMessage
$ningApi->comment
$ningApi->network
$ningApi->photo
$ningApi->user
$ningApi->video
$args['description'] = "Test blog post description.";
$args['title'] = "Test blog post title.";
$ningApi->blogPost->create($args);
NingApi::instance()->blogPost->create($args);
NingApi::instance()->setSubdomain(‘subdomain’);
__construct($subdomain, $consumerKey, $consumerSecret, $accessToken = NULL, $accessTokenSecret = NULL)
__construct($subdomain=null, $consumerKey=null, $consumerSecret=null, $email=null, $password=null)
Tags:
Hi Ben !
Thanks for this update. It's more powerfull like that.
Just a (potential) issue that frightens me : how can i get "author" field (screen name) now?
Pierre
Oh, please Ben, tell me it's me who does not understand anything and that I can still request screen name ...
Hi Pierre,
You are still able to get the author field from from all content. For fetching users, the call looks like this: NingApi::instance()->user->fetch($args);
You still have to specify a selection criteria, e.g. $args['id'] = '1234:User:678', but then by default the author field should be returned.
All of the methods still allow you to pass an arguments array that is identical to what you would pass to the NingApi in the previous version. If you'd like only a subset of possible fields, then you can set $args['fields'] to be the comma-separated list like you would in the previous api library version.
Sorry to scare you like that! There shouldn't be anything you cannot do with this new library version that you could with the previous, but let me know if you find otherwise.
-Ben
Hi ben.
And thanks for this precision. I confess I am a bit lost in the reingeniering of my code.
If I do that, it throw an exception (Missing one or more of the following required constants in /xxx/NingApi.php: subdomain, email, password, consumerKey, consumerSecret) on the second line :
$ningApi = new NingApi($subdomain, $ckey, $csecret, $name, $pass);
$ningApi->user->fetch($args);
What am I doing wrong ?
Pierre
Hi Pierre,
Sorry about that - that's definitely a bug. Thanks for pointing it out. I just pushed a fix for this to github, but please let me know if you see any more problems.
-Ben
This is great, thank you! Is this likely to be updated at any point? What are all the extra fields in the user, and how do I populate them?
Thanks :)
H,
The curl connection is returning the #7 error number.
I think its because my offices use a proxy so it might be blocking the connection somehow.
do you have any idea how i can fix this.
I did try adding this code below the $ch = curl_init(); line of the call method.
curl_setopt($ch, CURLOPT_TIMEOUT, self::CURL_TIMEOUT);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
curl_setopt($ch, CURLOPT_PROXY, "proxy_address");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, "my network address");
Any help is appreciated thanks in advance.
Posted by Kyle Ford on October 13, 2010 at 8:00am 3 Comments 3 Likes
Posted by Phil McCluskey on October 1, 2010 at 8:55am 0 Comments 1 Like
Posted by Kyle Ford on September 30, 2010 at 8:30pm 1 Comment 1 Like
© 2023 Created by Build Team.
Powered by