© 2013 Plum Group, Inc. All rights reserved.
5. Exporting Data in Excel/CSV Format Prev | Next 7. Sharing Reports |
To export responses in CSV format, you can perform a standard HTTP POST to the URL:
http://survey.plumvoice.com/ws/export-responses.php?function=getResponsesCSV
with the POST parameters login
, password
, and survey_id
. The login
and password
are your current survey account login and password. The survey_id
can be found when you click on the "Test" tab if your survey is in Testing stage ...
or the "Deploy" tab if your survey is in the Deployed stage.
A proper survey_id
is a series of digits followed by a hyphen followed by 8 more digits.
The following is an example for how you would access this service from a PHP script:
<?php
$params['login'] = "xxxxxx";
$params['password'] = "xxxxxx";
$params['survey_id'] = "xxx-xxxxxxxx";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_URL, "http://survey.plumvoice.com/ws/export-responses.php?function=getResponsesCSV");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
echo $result;
curl_close($ch);
?>
You would need to replace the xx'ed values with your own values. If you were to view this result of this script in a web browser, you would see text similar to the following:
Crayon Survey copy,,, Caller ID/IP Address,Start Date/Time,End Date/Time,What's your favorite crayon color?,Why do you like the color red?,Which of the following resembles the color red to you (choose all that apply):,Which of the following most closely represents the color yellow?,How much would you be willing to spend on a blue object?,Which of the following most represents the color blue?,What colors do you like?,Was this survey helpful? xx.xxx.xxx.xxx,27/June/2008 04:38:45 PM,27/June/2008 04:38:52 PM,Yellow,,,Banana,,,,yes xx.xxx.xxx.xxx,27/June/2008 04:38:56 PM,27/June/2008 04:39:08 PM,Blue,,,,123.45,Water,,yes xx.xxx.xxx.xxx,27/June/2008 04:51:15 PM,27/June/2008 04:51:25 PM,Other,,,,,,Gray,yes xxxxxxxxxx,27/June/2008 04:53:53 PM,27/June/2008 04:55:05 PM,Red,,"Fire Truck,Stop Sign",,,,,yes xxxxxxxxxx,27/June/2008 04:55:16 PM,27/June/2008 04:55:51 PM,Yellow,,,Banana,,,,no xxxxxxxxxx,27/June/2008 04:56:15 PM,27/June/2008 04:56:50 PM,Blue,,,,4.33,Sky,,yes xxxxxxxxxx,27/June/2008 04:
57:01 PM,27/June/2008 04:57:37 PM,Other,,,,,,,no xx.xxx.xxx.xxx,18/July/2008 05:02:31 PM,18/July/2008 05:02:39 PM,Red,,,,,,, xx.xxx.xxx.xxx,18/July/2008 05:02:45 PM,18/July/2008 05:02:52 PM,Yellow,,,Highlighter,,,,
This text is your responses returned in CSV format.
If you wanted to filter your CSV responses by date, you could add the POST parameters start_date
and end_date
to your POST request to http://survey.plumvoice.com/ws/export-responses.php?function=getResponsesCSV
. The start_date
or end_date
parameter accepts almost any string representation of a date or time. For example, you can enter a date in the "MM/DD/YYYY" format or use phrases such as "today" or "yesterday". The following PHP code demonstrates how you could add a start_date
or end_date
to your POST:
<?php
$params['login'] = "xxxxxx";
$params['password'] = "xxxxxx";
$params['survey_id'] = "xxx-xxxxxxxx";
$params['start_date'] = "09/23/2008";
$params['end_date'] = "09/30/2008";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_URL, "http://survey.plumvoice.com/ws/export-responses.php?function=getResponsesCSV");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
echo $result;
curl_close($ch);
?>
To do the same thing with the curl
utility, which is a free cross-platform command line program for fetching data from URL's, you could try something like the following:
curl -d login=XXXX -d password=XXXX -d survey_id=XX-XXXXXXXX -d start_date=1/21/2009+12:00am -d end_date=1/29/2009+1:00am http://survey.plumvoice.com/ws/export-responses.php?function=getResponsesCSV
Simply substitute your information for the XX's, and change the start and end dates. The CSV will be echoed to the terminal, although you can suffix the command with the option -o output_filename.csv
to save it to a file instead.
To export your responses in CSV format via SOAP, you can use the SOAP web service described by the WSDL at http://survey.plumvoice.com/ws/export-responses.php?WSDL, using the getResponsesCSV
method. The only parameters needed for the getResponsesCSV
method are your login, password, and the survey ID.
The following code demonstrates how you can do this in a PHP script:
<?php
header("Content-type: text/plain");
ini_set("soap.wsdl_cache_enabled", "0");
$wsdl = "http://survey.plumvoice.com/ws/export-responses.php?WSDL";
$soapClient = new SoapClient($wsdl, array('trace' => 1, 'exceptions' => 0));
if (isset($_GET['show_types'])) {
var_dump($soapClient->__getFunctions());
var_dump($soapClient->__getTypes());
}
$result = $soapClient->getResponsesCSV("yourlogin","yourpassword","yoursurveyid");
var_dump($result);
?>
Note that "yourlogin", "yourpassword", and "yoursurveyid" are where you would put your account login, account password, and the survey ID of the survey that you want to export responses from. See Section 6.1 above if you need more information on where you would obtain the login, password, and survey ID.
If you view the result in a web browser, you would see:
string(3677) "Crayon Survey copy,,,
Caller ID/IP Address,Start Date/Time,End Date/Time,What's your favorite crayon color?,Why do you like the color red?,Which of the following resembles the color red to you (choose all that apply):,Which of the following most closely represents the color yellow?,How much would you be willing to spend on a blue object?,Which of the following most represents the color blue?,What colors do you like?,Was this survey helpful?
xx.xxx.xxx.xxx,27/June/2008 04:38:45 PM,27/June/2008 04:38:52 PM,Yellow,,,Banana,,,,yes
xx.xxx.xxx.xxx,27/June/2008 04:38:56 PM,27/June/2008 04:39:08 PM,Blue,,,,123.45,Water,,yes
xx.xxx.xxx.xxx,27/June/2008 04:51:15 PM,27/June/2008 04:51:25 PM,Other,,,,,,Gray,yes
xxxxxxxxxx,27/June/2008 04:53:53 PM,27/June/2008 04:55:05 PM,Red,<file:xxxxxxxxxx-803167.wav>,"Fire Truck,Stop Sign",,,,,yes
xxxxxxxxxx,27/June/2008 04:55:16 PM,27/June/2008 04:55:51 PM,Yellow,,,Banana,,,,no
xxxxxxxxxx,27/June/2008 04:56:15 PM,27/June/2008 04:56:50 PM,Blue,,,,4.33,Sky,,yes
xxxxxxxxxx,27/June/2008 04:57:01 PM,27/June/2008 04:57:37 PM,Other,,,,,,<file:xxxxxxxxxx-803177.wav>,no
xx.xxx.xxx.xxx,18/July/2008 05:02:31 PM,18/July/2008 05:02:39 PM,Red,,,,,,,
xx.xxx.xxx.xxx,18/July/2008 05:02:45 PM,18/July/2008 05:02:52 PM,Yellow,,,Highlighter,,,,
xx.xxx.xxx.xxx,18/July/2008 05:03:25 PM,18/July/2008 05:03:32 PM,Blue,,,,,,,no
xxxxxxxxxx,18/July/2008 05:04:04 PM,18/July/2008 05:04:28 PM,Yellow,,,Sun,,,,no
xx.xxx.xxx.xxx,18/July/2008 05:04:32 PM,18/July/2008 05:04:38 PM,Red,,Stop Sign,,,,,no
xx.xxx.xxx.xxx,18/July/2008 05:05:21 PM,18/July/2008 05:05:29 PM,Blue,,,,,Jeans,,no
xx.xxx.xxx.xxx,18/July/2008 05:05:32 PM,18/July/2008 05:05:40 PM,Red,,"Fire Truck,Stop Sign",,,,,yes
xx.xxx.xxx.xxx,18/July/2008 05:05:49 PM,18/July/2008 05:05:57 PM,Other,,,,,,qweqweqweq,yes
xx.xxx.xxx.xxx,18/July/2008 05:06:19 PM,18/July/2008 05:06:31 PM,Blue,,,,12321,Sky,,no
xx.xxx.xxx.xxx,18/July/2008 05:06:35 PM,18/July/2008 05:06:42 PM,Yellow,,,Banana,,,,no
xx.xxx.xxx.xxx,18/July/2008 05:06:44 PM,18/July/2008 05:06:53 PM,Blue,,,,123123123123123123123,Water,,no
xx.xxx.xxx.xxx,18/July/2008 05:07:02 PM,18/July/2008 05:07:09 PM,Yellow,,,Highlighter,,,,yes
xx.xxx.xxx.xxx,18/July/2008 05:07:11 PM,18/July/2008 05:07:20 PM,Red,,"Fire Truck,Stop Sign,Brick",,,,,no
xx.xxx.xxx.xxx,18/July/2008 05:07:22 PM,18/July/2008 05:07:32 PM,Red,34ertertert,"Fire Truck,Stop Sign,Brick",,,,,no
xx.xxx.xxx.xxx,18/July/2008 05:07:58 PM,18/July/2008 05:08:08 PM,Red,dfgdfgd,"Stop Sign,Rose",,,,,no
xx.xxx.xxx.xxx,18/July/2008 05:08:55 PM,18/July/2008 05:09:52 PM,Blue,,,,123123123123,Jeans,,no
xx.xxx.xxx.xxx,18/July/2008 05:56:44 PM,18/July/2008 06:02:05 PM,Other,,,,,,sadasdasd,
xxxxxxxxxxx,13/August/2008 03:03:18 PM,13/August/2008 03:04:01 PM,Yellow,,,,,,,no
xxxxxxxxxxx,13/August/2008 03:03:27 PM,13/August/2008 03:04:59 PM,Red,,"Brick,Rose",,,,,no
xxxxxxxxxxx,13/August/2008 03:03:33 PM,13/August/2008 03:04:18 PM,Yellow,,,Banana,,,,yes
xxxxxxxxxxx,13/August/2008 03:03:33 PM,13/August/2008 03:04:18 PM,Yellow,,,Banana,,,,yes
xxxxxxxxxx,15/August/2008 10:50:37 AM,15/August/2008 10:51:07 AM,Yellow,,,Sun,,,,yes
xxxxxxxxxx,15/August/2008 10:50:37 AM,15/August/2008 10:51:51 AM,Red,<file:xxxxxxxxxx-803856.wav>,"Fire Truck,Rose,Fox",,,,,yes
xxxxxxxxxx,15/August/2008 10:50:58 AM,15/August/2008 10:51:51 AM,Blue,,,,1.00,Water,,
xx.xxx.xx.xx,29/September/2008 01:58:25 PM,29/September/2008 01:58:32 PM,Other,,,,,,,
xxxxxxxxxx,29/September/2008 02:01:47 PM,29/September/2008 02:02:53 PM,Blue,,,,2.85,Sky,,no
xxxxxxxxxx,29/September/2008 02:08:49 PM,29/September/2008 02:09:34 PM,Blue,,,,2.00,Jeans,,no
xxxxxxxxxx,1/October/2008 03:54:17 PM,1/October/2008 03:54:53 PM,Blue,,,,1.00,,,yes
If you want to filter your responses by date, you can submit a start date and end date parameter to the getResponsesCSV
method. This start date or end date parameter accepts almost any string representation of a date or time. You can enter a date in the "MM/DD/YYYY" format or use phrases such as "today" or "yesterday". The following is an example of how to accomplish this in a PHP script:
<?php
header("Content-type: text/plain");
ini_set("soap.wsdl_cache_enabled", "0");
$wsdl = "http://survey.plumvoice.com/ws/export-responses.php?WSDL";
$soapClient = new SoapClient($wsdl, array('trace' => 1, 'exceptions' => 0));
if (isset($_GET['show_types'])) {
var_dump($soapClient->__getFunctions());
var_dump($soapClient->__getTypes());
}
$result = $soapClient->getResponsesCSV("yourlogin","yourpassword","yoursurveyid","09/01/2008","09/30/2008");
var_dump($result);
?>
NOTE: We now have a SOAP web service tester available for you to test your web service against. For a link to this SOAP web service tester, see here.
To export audio responses, you can perform a standard HTTP POST to the URL:
http://survey.plumvoice.com/ws/export-responses.php?function=getResponsesAudio
with the POST parameters login
, password
, and survey_id
. See Section 6.1 above if you need more information on where you would obtain the login
, password
, and survey_id
.
The following example demonstrates how you would do this in a PHP script:
<?php
$params['login'] = "xxxxxx";
$params['password'] = "xxxxxx";
$params['survey_id'] = "xxx-xxxxxxxx";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_URL, "http://survey.plumvoice.com/ws/export-responses.php?function=getResponsesAudio");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
echo $result;
curl_close($ch);
?>
If you were to save the output of this code as a .zip file, you would have a ZIP archive of audio responses for your survey.
This is an example archive downloaded from this service. Notice that the naming of your audio files corresponds to the <file:###-###.wav>
tokens found in downloaded CSV response data. This allows you to correlate your downloaded audio responses with each unique response.
If you wanted to filter these audio responses by date, you could add a start_date
and end_date
parameter to your POST request. This start_date
or end_date
parameter accepts any string representation of a date and time, whether it be in "MM/DD/YYYY" format or a phrase like "today" or "yesterday". The following example shows how to use this in a PHP script:
<?php
$params['login'] = "xxxxxx";
$params['password'] = "xxxxxx";
$params['survey_id'] = "xxx-xxxxxxxx";
$params['start_date'] = "09/23/2008";
$params['end_date'] = "09/30/2008";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_URL, "http://survey.plumvoice.com/ws/export-responses.php?function=getResponsesAudio");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
echo $result;
curl_close($ch);
?>
To do the same with the curl
utility, which is a free command-line program for fetching data from URL's, you could try something like the following:
curl -d login=XXXX -d password=XXXX -d survey_id=XX-XXXXXXXX -d start_date=1/21/2009+12:00am -d end_date=1/29/2009+1:00am http://survey.plumvoice.com/ws/export-
responses.php?function=getResponsesAudio -o output_file.zip
Simply substitute your information for the XX's, and replace the start and end dates. The ZIP file will be saved to output_file.zip
.
To export your audio responses via SOAP, you can use the SOAP web service described by the WSDL at http://survey.plumvoice.com/ws/export-responses.php?WSDL, using the getResponsesAudio
method with the following parameters: login
, password
, and survey_id
. The following is an example of how to access this service in a PHP script:
<?php
header("Content-type: text/plain");
ini_set("soap.wsdl_cache_enabled", "0");
$wsdl = "http://survey.plumvoice.com/ws/export-responses.php?WSDL";
$soapClient = new SoapClient($wsdl, array('trace' => 1, 'exceptions' => 0));
if (isset($_GET['show_types'])) {
var_dump($soapClient->__getFunctions());
var_dump($soapClient->__getTypes());
}
$result = $soapClient->getResponsesAudio("yourlogin","yourpassword","yoursurveyid");
var_dump($result);
?>
Note: See Section 6.1 above if you need more information on where you would obtain the login, password, and survey ID.
The result of the method, getResponsesAudio
, is a string. This string is a Base64 encoded ZIP archive of your audio responses. You would have to Base64-decode this string and then unzip the archive to obtain the audio responses. Base64 encoding is used to prevent the binary ZIP archive data from interfering with the XML nature of SOAP responses.
The above shows the contents of an example archive. Notice that the naming of your audio files corresponds to the <file:###-###.wav>
tokens found in downloaded CSV response data. This will allow you to correlate your downloaded audio responses with each unique response.
To filter your audio responses by date, you can submit a start date and end date parameter to the getResponsesAudio
method. This start date or end date parameter accepts any string representation of a date and time, whether it be in "MM/DD/YYYY" format or a phrase like "today" or "yesterday". The following example shows how to do this in a PHP script:
<?php
header("Content-type: text/plain");
ini_set("soap.wsdl_cache_enabled", "0");
$wsdl = "http://survey.plumvoice.com/ws/export-responses.php?WSDL";
$soapClient = new SoapClient($wsdl, array('trace' => 1, 'exceptions' => 0));
if (isset($_GET['show_types'])) {
var_dump($soapClient->__getFunctions());
var_dump($soapClient->__getTypes());
}
$result = $soapClient->getResponsesAudio("yourlogin","yourpassword","yoursurveyid","09/01/2008","09/30/2008");
var_dump($result);
?>
NOTE: We now have a SOAP web service tester available for you to test your web service against. For a link to this SOAP web service tester, see here.
5. Exporting Data in Excel/CSV Format Prev | Next 7. Sharing Reports |