Pardon if this is too basic to question, I am trying to integrate a feature on the mobile version of my website where beside the contact number, I want links which say "Call", "Send SMS" and "Save to Contacts".
I created a vCard (vCard.vcf) with the contact details and made the third link a simple hyperlink and it seems to work ok for now (please let me know if there is a better way of doing this!)
Now, in order to enable calling and sms features, I went by the tutorial at
http://pointbeing.net/weblog/2010/01/making-phone-calls-and-sending-sms-with-html.html
But this is generating a simple url for the href (this was tested on android) and the resultant link when clicked, says URL not found and returns Error 404.
Here is my code -
- Code: Select all
<?php
require_once('Tera-WURFL/TeraWurfl.php');
$wurflObj = new TeraWurfl();
$wurflObj->getDeviceCapabilitiesFromAgent();
// see if this client is on a wireless device
if($wurflObj->getDeviceCapability("is_wireless_device")){
echo "I see you are accessing my site from a wireless device :)<br>";
}
else{
echo "I see you are accessing my site from a desktop device!<br>";
}
// get the capabilities from the object
if ( $wurflObj->GetDeviceCapabilitiesFromAgent($agent) ) {
$caps = $wurflObj->capabilities;
$smsstring = $caps['xhtml_ui']['xhtml_make_phone_call_string'];
}
?>
<!-- some HTML here -->
<?php if ( $smsstring != 'none' ) : ?>
<p><a href="<?php echo $smsstring; ?>0000000000">Call</a>.</p>
<?php endif; ?>
<?php
$smsstring = $caps['xhtml_ui']['xhtml_send_sms_string'];
?>
<?php if ( $smsstring != 'none' ) : ?>
<p><a href="<?php echo $smsstring; ?>0000000000?body=Hi">Send SMS</a>.</p>
<?php endif; ?>
Of course, the 0000000000 is my actual cell phone number. And the first if/else statement was just to verify if the script detected the wireless device properly, which is working perfectly fine!
I am totally new to all this, so please guide me
Thanks in advance for your time and thoughts!