Joomla-Call Webservice

Hello Friends,

Here is one simple example of how we can use our Joomla application to provide WebService call made by other iPhone application.

http://domain.com/index.php?option=com_iphone&controller=news&task=getLatestNews

Upon accessing the above URL, it will call the method name getLatestNews() from controller file news.php located at path /www/components/com_iphone/controllers/

function getLatestNews()
{
global $mainframe;

$db = jFactory::getDBO();

$qry=”SELECT * FROM #__news ORDER BY date DESC”;
$db->setQuery( $qry );
$db->Query();
$aData = $db->loadObjectList();

ob_get_clean();

ob_clean();

$str = “<?xml version=\”1.0\” encoding=\”UTF-8\”?>”;

$str .= “<xml><news>”;

for ($i=0, $n=count( $aData ); $i < $n; $i++)
{
$row = &$aData[$i];

$str .= “<feed>”;

$str .= “<headline>”.$row->title.”</headline>”;

$str .= “<date>”.$date.”</date>”;

$str .= “<description>”.$row->details.”</description>”;

$str .= “</feed>”;
}

$str .= “</news></xml>”;

header(“Content-Type: text/xml”);

echo $str;

exit;
}

Look at this URL: http://www.easyapns.com/

There is complete documentation and ready made code and database structure through which we can send notification on any registered iPhone mobiles using apple’s push notification service called APNS.

The code is available in PHP technology. To setup it we just need to install few tables in Joomla database and based on sample php files they’ve already provided we can create interface in our application from where Admin/User can send any kind of text message/notification to any iPhone users worldwide!

Thanks.

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

Advertisements
%d bloggers like this: