How to use Surveys in CakePHP with very little development.2018-11-01
How to use Surveys in CakePHP with very little development hours.
CakePHP is one of the most favorable PHP frameworks out there and we understand that PHP developer want to be enabled to extend it to use Survey. In this article we will go through how to use CakePHP and Surveys in a way so that you can automatically let your users answer surveys from your Examinare account. Of course some steps can be different from what you would like todo in your application. We are here to help of course, just send an email to email@example.com and we will help you along the way.
Step 1: Create a new Examinare account or a Developer Account and activate the API functions.
In your Examinare account you will need to activate the API functionality inside Settings -> Advanced Settings. You will then be presented with an API Key and a CompanyID. Save these for later. If you prefer to use a different to use a special API key for this solution then see our Mobile API key functionality.
Step 2: Build your Survey inside Examinare.
Build your survey inside the Examinare platform. Make sure you deploy it as a private survey.
Step 3: Build a registration form.
We start by creating a new form for this. In that form we will add the name and the email of the person who will get the survey.
So we start with this code:
We can of course if possible skip this step if you have already authorized the person who already loggedin. To retrieve that information depends on your CakePHP enviroment.
So when this form has been created we also need to catch the details and create the recipient and redirect the person to the form.
So add this into your controller:
The above code will use 3 functions inside the Examinare API to create a recipient, make the recipient to redirect to the survey. You will of course need to have the ID for the survey that you previously created inside Examinare. The Survey needs to be deployed as a Private survey to return the correct API return.
Step 4: Create a customized thank you page inside the CakePHP (optional).
If you want to create a customized thank you page inside your CakePHP and also parse the data from the survey then this can be done inside the last call. Edit the
header(“Location: ”. $urltoredirect);exit();
And add the following code to redirect
header(“Location: ”. $urltoredirect.”&redirect_url=”.encode_url(“YOUR REDIRECT URL”));exit();
This will redirect the recipient after completion to a thank you page. Also in that URL there is a way of getting the ContactID and Inforreg to get the data. Check out the sample code inside the Zendesk Article here to see how to catch these details. Then you can process exactly how you want it.
Also check out the following API calls for reference:
Also make sure you download the PHP Wrapper Library.
Find out how Examinare can help you! One of our Examinare experts will contact you shortly to discuss your needs and how you can benefit from Examinare Solutions.
Fill in the form and we will contact you shortly.