Self Registration

This is the first application I have built that has utilized the Articulate Online API.

What it does?

This web application takes the email address and password from a form on a web page and then creates a user on a specified Articulate Online account.  In other words, it does “self-registration.”

What are the requirements?

  • An Articulate Online account with the AO API enabled (How to?)
  • A server that supports and has PHP installed
  • Nusoap (don’t be scared by this, it is free, and I’ll explain later)

How it works?

Here is basically what happens:

  1. A user goes to the registration form (selfreg.php)
  2. The user fills in the form and clicks “Register”
  3. The form data is sent to register.php
  4. register.php takes the data from the form, connects to the AO API
  5. register.php tries to create the user in your Articulate Online account
  6. The user gets a status message saying they were added to the Articulate Online account (or not added in the case of an error)

Installation and Configuration Instructions:

Installation and configuration is meant to be pretty straight forward and as painless as possible. 

Here is what you need to do:

1. Install nusoap

Nusoap is basically just a set of files (PHP class files) that allow you to connect to the Articulate Online API via PHP.

  1. Download nusoap from SourceForge
  2. Unzip the files
  3. Upload the folder to your webserver

That’s it.  You now have access to nusoap.

2. Next, Install and Configure the application

There are 3 files included in this application:

  • selfreg.php – is a straight forward HTML page that contains a form that asks for email, password, and confirm password.  It also does some input validation to make sure the email address is valid, and the passwords are valid passwords.
  • register.php – is the meat of the application.  It connects to the API, creates the user, then gives a status message (success, or fail)
  • config.php – contains all the configuration options of the application.
  1. Download the source files here.
  2. Unzip the files
  3. Open the register.php file in notepad
  4. Find this line:
    require_once(‘../../lib/nusoap.php’); 
  5. Change this section ‘../../lib/nusoap.php’ to point to your nusoap installation
  6. Open config.php in notepad
  7. The config.php file contains all the configuration options for your application.  You will need to change these to meet your needs.  In this file you will have several different variables you need to set.  These variables are what are used to connect to the API, and what you want the app to do.  Here is an explanation of what they are:
    $emailaddress – an administrators email address
    $password – the administrators password
    $customerID – your customer ID.  Your customer ID can be found by looking at the URL in your browser’s address bar after logging in to Articulate Online. The numeric value specified in the title bar for CustID is your customer id.
    $accountURL – the URL of your Articulate Online account.
    $sendLoginEmail – When a user registers, should AO send them an email?  (true/false are values)
    $comment – If you want to send an email to the registered user, what text should it contain.  Leave blank for nothing.
  8. After changing the configuration options, save the config.php file
  9. Upload the application to your website

You are done, that is it.

Try the application

Now that you have installed and configured the application, point your browser to the selfreg.php file.  Fill in the options and test it out.

Sample in action

Now that I have explained the applicaiton, maybe you want to check it out.  I have uploaded this sample to my website, and connected it to a sample Articulate Online account.  You can try it here:

http://www.mozealous.com/samples/selfregister/selfreg.php

Once you have registered, you will be given an opportunity to login to my Articulate Online account as a newly registered user.

That is it, hope this was all straight forward and easy to follow.  Feel free to comment if you have any questions!

{ 1 trackback }

6 Examples of What’s Possible with the Articulate Online API: E-Commerce & More - Articulate - Word of Mouth Blog
April 24, 2009 at 9:48 am

{ 19 comments… read them below or add one }

Jon LEED Certification August 18, 2009 at 11:56 am

Dave,
Your registration.php file has an error on line 45. PHP’s SOAP client was enabled, this was causing a conflict.

Instead of calling:
$client = new soapclient($accountURL.’/services/api/1.0/ArticulateOnline.asmx?wsdl’,array(‘encoding’=>’UTF-8′));
ini_set(“soap.wsdl_cache_enabled”, “0″);

I needed to call the following to make it work:
$client = new nusoap_client($accountURL.’/services/api/1.0/ArticulateOnline.asmx?wsdl’,array(‘encoding’=>’UTF-8′));
ini_set(“soap.wsdl_cache_enabled”, “0″);

mozealou August 18, 2009 at 1:58 pm

cool Jon, thanks for the heads up. I’ll make sure I update the sample ASAP.

Dave Mozealous September 1, 2009 at 8:21 am

Long delay in replying here, but I just gave this a shot without making that modification and it works for me Jon. Not sure what would cause that to happen, but if anyone runs into problems with this I’ll keep it in mind.

KP September 17, 2009 at 1:23 pm

Hello,

I’m getting a weird reaction from the scripts. I have it set up on 2 different servers and it works on one and not the other.

Any idea why that would be? The only difference is one is a windows box, the other is linux. Other than that, the files are the exact same.

mozealou September 17, 2009 at 1:30 pm

Hi KP,

Did you see this comment above?
========
Instead of calling:
$client = new soapclient($accountURL.’/services/api/1.0/ArticulateOnline.asmx?wsdl’,array(’encoding’=>’UTF-8′));
ini_set(”soap.wsdl_cache_enabled”, “0″);

I needed to call the following to make it work:
$client = new nusoap_client($accountURL.’/services/api/1.0/ArticulateOnline.asmx?wsdl’,array(’encoding’=>’UTF-8′));
ini_set(”soap.wsdl_cache_enabled”, “0″);

=====
If you make that change does it work?

Also, you might want to try adding this debug info at the end of your script on the box that it works, and the box that it doesn’t and compare the output:


echo 'Request';
echo htmlspecialchars($client->request, ENT_QUOTES);
echo 'Response';
echo htmlspecialchars($client->response, ENT_QUOTES);
echo 'Debug';
echo htmlspecialchars($client->debug_str, ENT_QUOTES);

This will show you the webservice request and response in XML and should help you debug.

KP September 17, 2009 at 2:27 pm

I’m getting this error when using $client = new nusoap_client:

HTTP ERROR: The PHP cURL Extension is required for HTTPS or NLTM. You will need to re-build or update your PHP to included cURL.

I have checked my php.ini and extension=php_curl.dll is active.

When I use $client = new soapclient, I don’t get any debug information or errors. It’s just a blank grey box.

mozealou September 17, 2009 at 2:39 pm

What happens if you try this:
< ?php
var_dump(curl_version());
?>

I can’t say that I am a PHP expert by any stretch of the imagination, and I have only installed it on Linux, but I’ll help if I can.

KP September 17, 2009 at 2:52 pm

I get a blank grey box. No errors are displayed.

mozealou September 17, 2009 at 2:56 pm

Looks like curl probably is the culprit. If it is working correctly you should get something like this:
http://www.mozealous.com/downloads/curl.php

KP September 17, 2009 at 9:30 pm

Thank for your help. I found a couple sites that explain how to enable curl for IIS Windows based servers. I will post them for any future users of the selfreg script.

One last questions, is there a way to add more user fields for input (first, last, company, address, phone, etc)? And pass through to Articulate on user registration?

KP September 18, 2009 at 10:07 am

I tried passing this through on the reg.php page:

$emailaddress
$password
$customerID
$newFirst
$newLast
$newCompany
$newTitle
$newAddress
$newCity
$newState
$newZip
$newPhone

But it’s not taking. I see in the API how to do it with Update Profile, but is there a way to do it with the self registration page in 1 step?

Dave Mozealous September 18, 2009 at 12:06 pm

Hi KP,

Sorry for the delayed response, was out of the office this morning.

Yeah, currently the Self Registration page just does a CreateUser, but you could modify it to after creating the user do an UpdateUserProfile with the requested information.

So you would need to modify my script.

anil kumar April 27, 2010 at 4:02 am

Dave,
I am downloaded your scrip(Self Registration)t and i have used in my local system .i didn’t changed your config file but it is giving an error because it is already running in remote system
my quetion is that script works in my local system or not please tell me as soon as possible

Thank you

Dave Mozealous April 27, 2010 at 6:48 am

Hi Anil,

Not sure I follow, what do you mean that “it is already running in remote system”? Can you paste the exact error message?

If you are trying to use the self registration example on your Articulate Online site you will definitely want to update the config file because I changed the config values to dummy values.

-Dave

anil kumar April 29, 2010 at 1:41 am

Hi
Dave,

I have done with the self registration successfully but when ever i want to do the update document security i am getting an error i am passing the request as

$emailAddress
$password
$customerID

$newDocumentID
Private

$newEmail

“;
i am passing the $newEmai=’abcd@gmail.com’ this was giving the error and what parameter should i pass for i want this answer urgent

Thanks

anil kumar April 29, 2010 at 1:42 am

Hi
Dave,

I have done with the self registration successfully but when ever i want to do the update document security i am getting an error with AllowedAccountIDs

i am passing the AllowedAccountIDs as ‘abcd@gmail.com’ this was giving the error and what parameter should i pass for AllowedAccountIDs i want this answer urgent

Thanks

andy April 29, 2010 at 4:53 am

Dave,
when i am trying to create the user i am getting an error “please enter a list of email addresses” how should i solve this error

Dave Mozealous April 29, 2010 at 8:18 am

Hi Anil,

The AllowedAccountID should be a GUID, not an email address. So it would be something like this:
1dc1aa4e-c0ed-415b-8d7d-5223fea7aab0

-Dave

Dave Mozealous April 29, 2010 at 8:19 am

Are you passing in an email address?

-Dave

Leave a Comment