Caller ID/IP Address in Web Services Post

Questions and answers about Plum Survey

Moderators: admin, support

  • Author
  • Message
Offline

support

  • Posts: 3602
  • Joined: Mon Jun 02, 2003 3:47 pm
  • Location: Boston, MA

Re: Caller ID/IP Address in Web Services Post

PostThu Aug 05, 2010 3:02 pm

Hi Fred,

You can find some documentation on integrating your surveys with SOAP webservices here. You also want to make sure that your Survey Settings are configured such that the Identifying Info is set to "Store".

Hope this helps.

Regards,
Plum Support
Offline

support

  • Posts: 3602
  • Joined: Mon Jun 02, 2003 3:47 pm
  • Location: Boston, MA

Re: Caller ID/IP Address in Web Services Post

PostThu Aug 05, 2010 4:09 pm

Hi,

As an example of how you can extract the ANI and the IP within your webservice, here is a code sample:

getaniorip.php:
Code: Select all
<?php
include_once('WSDL_Gen.php');
$NAMESPACE = "http://www.ourserver.com";
$WS_DOC_CSS = "ws_doc.css";
$DESCRIPTION = "An example of how to use WSDL_Gen.php";

function HTTP_Post($URL,$data, $referrer="") {

         // parsing the given URL
         $URL_Info=parse_url($URL);

         // Building referer
         if($referer=="") // if not given use this script as referer
           $referer=$_SERVER["SCRIPT_URI"];

         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL,$URL_Info["host"].$URL_Info["path"]);
         curl_setopt($ch, CURLOPT_HEADER,1);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
         curl_setopt($ch, CURLOPT_REFERER, $referer );
         curl_setopt($ch, CURLOPT_POST,1);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
         $result=curl_exec ($ch);
         curl_close ($ch);
         return $result;
}


/**
 * This is a web service class that implents two simple functions
 **/
class SampleWebservice extends Services_Webservice {
  /**
   *
   * @param string $answer
   * @return string
   **/
  function getaniorip($answer) {
      if ($answer == 'yes'){
        return $_COOKIE['ani'];
      }
  }
}

$myService = new SampleWebservice($NAMESPACE, $DESCRIPTION, array('uri'=>$NAMESPACE, 'encoding'=>SOAP_ENCODED));
$myService->handle();

?>


From this example, we have set up our webservice to check if a survey response has been answered with a "yes". If the respondent has answered "yes", the line:

return $_COOKIE['ani'];

will return the ANI (caller ID) of the user (if they took the survey by phone). You can similarly use this to extract the IP of the user (if they took the survey by web) with the line:

return $_COOKIE['ip'];

Regards,
Plum Support
Offline

support

  • Posts: 3602
  • Joined: Mon Jun 02, 2003 3:47 pm
  • Location: Boston, MA

Re: Caller ID/IP Address in Web Services Post

PostFri Aug 06, 2010 2:27 pm

Hi Fred,

You actually do not need to do anything when serving the WSDL file. By default, when we POST to the service URL, we include the Cookie: header. At this point, you can extract the cookie using your code. If you were to send back HTTP Set-Cookie: headers, you would overwrite the cookies that are already stored.

If you need any further clarification, please do not hesitate to ask. We will be more than happy to help.

Regards,
Plum Support
Offline

support

  • Posts: 3602
  • Joined: Mon Jun 02, 2003 3:47 pm
  • Location: Boston, MA

Re: Caller ID/IP Address in Web Services Post

PostMon Aug 09, 2010 9:03 am

Hi Fred,

It seems that there has been some confusion in this forum post. You would only want to use the cookies for 'ani' or 'ip' if you're acting upon them within your survey.

However, for reporting purposes, if you're looking to extract the ANI or IP address for your survey responses, this is already being provided to you (as long as you have "Identifying Info" set to "Store" in your Survey Settings; see here on how to set this).

For an example of how to extract your survey responses via SOAP, there is a short example provided in the survey documentation here.

From that example, you can see that the ANI or IP Address is provided along with the survey responses, as well as the Start Date and End Date of the entire survey (not the survey page).

Hope this clarifies things. If you have any more questions regarding this issue, please feel free to ask.

Regards,
Plum Support
Offline

arnav

  • Posts: 1
  • Joined: Thu Jun 06, 2019 3:27 am
  • Location: pune

Re: Caller ID/IP Address in Web Services Post

PostThu Jun 06, 2019 3:29 am

Thanks

Return to Plum Survey Q&A

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron