Welcome to the Ifbyphone Developers zone. This forum provides a place for the community of advanced Ifbyphone users and developers to share ideas, exchange code, and ask questions.  

Additional Resources

Ifbyphone Company Blog - Ifbyphone Twitter Page - Ifbyphone Company Web Site - Ifbyphone Partners Page
Ifbyphone's CEO's (Irv Shapiro's) Personal Blog - Irv Shapiro Twitter Page

It has been brought to our attention that the NEW MEMBER link does not always display in IE7. If you do not see the new member link in the login box on the right, please try another browser. (Firefox works fine.) In addition please note that Phonemashup accounts are completely separate from Ifbyphone accounts.

If you need help fast, call 877 295 5100 to reach the Ifbyphone "Success Team".   (Support is option 2.)

Members Login
Username
 
Password

 
 
Ifbyphone Home Page -> Ifbyphone Developer Zone -> Interesting Ifbyphone Applications -> White Pages Mashup
Post InfoTOPIC: White Pages Mashup
KhyleK



Veteran Member

Posts: 41
Date: Jul 9, 2009
White Pages Mashup
  


I recently wrote a mashup that uses reverse lookup information from Whitepages.com.  The mashup uses two Survos from Ifbyphone.  The first one simply passes the caller ID to the PHP code below.  The second Survo reads back the message we construct below.  You can hear the mashup in action (for a limited time) at 866.390.9675.  Here is the code:

<?php

// CAPTURE THE BUSINESS PHONE NUMBER SENT FROM IFBYPHONE
$phone = $_REQUEST['phone'];

//Add spaces to the phone number so TTS speaks it as single digits

for ($i=0; $i<=10; $i++) {
$formattedphonenum .= " " . substr($phone, $i, 1);
}

$valid_business_survo = "SURVOID";

$key = "WHITEPAGES.COMAPIKEY";
$url = "http://api.whitepages.com/reverse_phone/1.0/?phone=$phone&outputtype=JSON;api_key=$key";
$results = file_get_contents($url);
$obj = json_decode($results);

$message = "The number you are calling from is $formattedphonenum . . ";
$type = $obj->listings[0]->phonenumbers[0]->type;
if (is_null($type)){
$message .= "I cannot determine whether you are calling from a landline or a mobile phone. ";
} else{
$message .= "I think you are calling from a " . $type . " phone. ";
}
$displayname = $obj->listings[0]->displayname;
if (is_null($displayname)){
$message .= "Also, I could not find a name associated with this number";
}
else {
$message .= "I see that the name associated with this number is " . $obj->listings[0]->displayname;
}
$xml_return = "<action>
<app>survo</app>
<parameters>
<id>$valid_business_survo</id>
<user_parameters>
<message>$message</message>
</user_parameters>
</parameters>
</action>";
echo $xml_return;

?>

-- Edited by KhyleK on Friday 10th of July 2009 11:46:26 AM

Page 1 of 1 sorted by
 

Quick Reply
Please log in to post quick replies.
Ifbyphone Home Page -> Ifbyphone Developer Zone -> Interesting Ifbyphone Applications -> White Pages Mashup
Jump To:


Post to Del.icio.usPost to FacebookPost to Digg


This is an open and public forum so Ifbyphone is unable to ensure that all code and suggestions posted to this forum are correct. Please use all code posted here at your own risk. Ifbyphone assumes no liability for code, recommendations and suggestions posted to this forum.

Users and developers will find hundreds of useful posts at the Ifbyphone company blog.