Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tidal/ape_php

PHP Client Library for APE Ajax Push Engine
https://github.com/tidal/ape_php

Last synced: 6 days ago
JSON representation

PHP Client Library for APE Ajax Push Engine

Awesome Lists containing this project

README

        

APE_PHP
==============

Lightweight PHP Client Library to Connect to an APE (APE Ajax Push Engine) server.
Fully unit tested with PHPUnit.

API
------------------------
see:
[http://tidal.github.com/APE_PHP/docs/api/annotated.html](http://tidal.github.com/APE_PHP/docs/api/annotated.html)

USAGE
------------------------

This example is meant to be used as a replacement for the PHP code
found in the APE_JSF Controller demo.

$APEPassword,
'raw' => 'postmsg',
'channel' => 'testchannel',
'data' => array(
'message' => 'Hello APE'
)
);

if(ApeFileConnection::available()){
$conCls = 'ApeFileConnection';
}elseif(ApeCurlConnection::available()){
$conCls = 'ApeCurlConnection';
}else{
die('No valid Ape-Connection availabe');
}

$connection = new $conCls($APEhost, $APEport);
$client = new ApeClient($connection);
$request = new ApeRequest('inlinepush', $params);
$response = $client->sendRequest($request);
$res = $response->getResult();
if ($res->data->value == 'ok') {
echo 'Message sent !

'.print_r($res, 1).'
';}
else {
echo 'Error sending message, server response is :
'.print_r($res, 1).'
';
}
?>

Other approach using ApeClient as a request gateway

dispatchRequest('inlinepush', $params);
if ($response->getResult()->data->value == 'ok') {
echo 'Message sent !

'.print_r($response->getResult(), 1).'
';}
else {
echo 'Error sending message, server response is :
'.print_r($response->getResult(), 1).'
';
}
?>