Create a Photo Competition App accessible to members on my network.

Member actions:

1. Add photo(s), description(s)

 

Admin actions;

1. Create an album for the competition

2. Set limit for number of photo submissions per member

3. Approve Photos

4. Restrict certain members from participating in competition 

 

This photo app should ideally be a Profile App. I later have to create a mobile app for IPHONE for the same functionality.

 

What I have done so far:

1. I have upgraded my Network to Ning Pro.

 

Need advice (from Devin and others) moving forward:

1. I know how to get the consumer key and consumer secret.

   How do I access Ning API to write PHP code ?

2. Do I have to setup a separate server environment on a host like Godaddy to access

   NIng API ?  

   I am afraid, I have searched Ning discussions and have not found documentations

   on how to set up the environment to enable me to access NIng API.

 

Please help.

Thanks

- Belal

 

 

 

 

 

Views: 469

Reply to This

Replies to This Discussion

Hi Belal,

1. To access the consumer key and secret, browse to the /main/extend/keys page on your Pro network.  More details here: http://build.ning.com/profiles/blogs/getting-started

2. Yes, you'll need to have your own server in order to make requests to Ning.  If you're working in PHP, a Linux shared hosting account on GoDaddy should be sufficient.  Here's a guide to getting going in PHP: http://developer.ning.com/docs/ningapi/1.0/examples/php/php.html

Let me know if you have any more questions.

- Phil

Hi Phil,

Thanks for getting back to me.

I put the Ning API files in my GoDaddy server account where I'm running Wordpress.

Below are the first 7 lines of my NingApi.php file:

1 <?php

2 define('SRC_PATH', __DIR__);

3 define('OBJECTS_PATH', SRC_PATH . '/objects');

4 set_include_path(get_include_path() . PATH_SEPARATOR . SRC_PATH . PATH_SEPARATOR . OBJECTS_PATH);

5 require_once('OAuth.php');

6 require_once('NingException.php');

7 require_once('NingObject.php');

 

When I test, I can access the NingApi.php file. I get an error in line 4 and line 7(when NingObject.php is being called).

 

Error:

Warning: require_once(NingActivityItem.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/m/o/n/monitor12/html/app/ning-api-php/src/NingObject.php on line 4

Fatal error: require_once() [function.require]: Failed opening required 'NingActivityItem.php' (include_path='.:/usr/local/php5/lib/php:__DIR__:__DIR__/objects') in /home/content/m/o/n/monitor12/html/app/ning-api-php/src/NingObject.php on line 4

 

The 'absolute path' is on my server acct is "/home/content/m/o/n/monitor12/html/".

I think the error that I am getting is because of the 'absolute path'. It may also be a Wordpress problem.

Please suggest a solution.

Thanks

- Belal  

 

The error there is in NingObject.php, not NingApi.php.  Have you copied the 'objects' directory up to the web server?  It looks like you have NingApi.php and NingObject.php but not objects/NingActivityItem.php.

Hi Phil,

It worked.

1. I had to fix the path in NingObject.php, for instance:

----------------------------------

<?php

require_once('NingApi.php');

require_once('objects/NingActivityItem.php');

require_once('objects/NingBlogPost.php');

require_once('objects/NingBroadcastMessage.php');

require_once('objects/NingComment.php');

require_once('objects/NingNetwork.php');

require_once('objects/NingPhoto.php');

require_once('objects/NingUser.php');

require_once('objects/NingVideo.php');

require_once('objects/NingFriend.php');

require_once('objects/NingTag.php');

----------------------------------

2. I also had to fix the path in all the files under the 'objects' folder.

For instance, in NingActivityItem.php, I changed the path where it calls NingObject.php

from

require_once('NingObject.php');

to

require_once('ning-api-php/src/NingObject.php');

 

In short, the objects in the 'object' folder extend NingObject, but they couldn't find NingObject so the file path had to be fixed accordingly.

Thanks again.

- Belal

 

 

That's odd.  Perhaps set_include_path isn't working on your server?  Glad to hear you got it working!

Hi Phil,

My project is to create a Photo Competition.

My tasks:

1. Allow user to add a photo to a photo album.

    How can I specify an album name and author (screenname) when adding a photo ?

    Can I retrieve a list of unapproved photos for a particular album ?

 

Also do you have good examples on how to use the restful api resource links. REST is all new to me.

Please help.

- Belal

 

More questions for Phil:

While adding a photo I'm getting the following error:

Fatal error: Uncaught cURL error: failed creating formpost data thrown

 

The reason for this error is probably(see in bold)

$parts = array(  "title" => $_POST["title"],  

"description" => $_POST["description"],  

"file" => "@\C:\Users\BBB\Desktop\DSC03028.jpg" );

Is Ning API expecting the full local path appended by "@\" ?

If so, I need to store the local path value using Javascript and then append "@\" .

Where am I erring in terms of "file" ? Please help.

- Belal

 

 

 

 

I don't think you can specify an album name... looking at the documentation and our code, I don't see anything for that.

The name / screenname on the photo are taken from the credentials used to upload it.  Authenticate as the user whose details you want to see on the photo.

As for your error, try prepending @ rather than @\ to the URL.  (This is a cURL thing -- see http://us.php.net/manual/en/function.curl-setopt.php, in particular example #2).

Thanks Phillip.

- Belal



Phillip Pearson said:

As for your error, try prepending @ rather than @\ to the URL.  (This is a cURL thing -- see http://us.php.net/manual/en/function.curl-setopt.php, in particular example #2).

Reply to Discussion

RSS

Blog Posts

Getting Started

Posted by Kyle Ford on October 13, 2010 at 8:00am 3 Comments

A Note on API Pricing

Posted by Phil McCluskey on October 1, 2010 at 8:55am 0 Comments

Welcome to Build!

Posted by Kyle Ford on September 30, 2010 at 8:30pm 1 Comment

Ning Status

© 2024   Created by Build Team.   Powered by

Badges  |  Report an Issue  |  Terms of Service