Example #1
0
 function Trilulilu($user, $hash)
 {
     //am creat o functie cu parametrii $user si $hash care returneaza request-ul serverului AMF
     $client = new SabreAMF_Client('http://www.trilulilu.ro/amf');
     //am deschis conexiunea AMF catre serverul trilulilu
     return $client->sendRequest('file.audio_info', array($user, $hash, "play"));
     //am trimis datele catre server si am returnat rezultatul
 }
 /**
  * @return SabreAMF_Client
  */
 protected function _buildSabreAmfClient()
 {
     if (!class_exists('SabreAMF_Client', true)) {
         @(require_once 'SabreAMF/Client.php');
     }
     if (!class_exists('SabreAMF_Client', true)) {
         throw new Exception('For using `sfPhpunitAmfClient` you need to have SabreAMF 1.3.x or above. It can be stored in project lib or installed throught PEAR. For more info please visit: http://osflash.org/sabreamf');
     }
     $c = new SabreAMF_Client($this->_endPoint);
     if (!is_null($this->_encoding)) {
         $c->setEncoding($this->_encoding);
     }
     if (!is_null($this->_httpProxy)) {
         $c->setHttpProxy($this->_httpProxy);
     }
     if (is_array($this->_credentials)) {
         $c->setCredentials($this->_credentials['username'], $this->_credentials['password']);
     }
     if (is_array($this->_header)) {
         foreach ($this->_header as $data) {
             $c->setHeader($data['name'], $data['required'], $data['data']);
         }
     }
     return $c;
 }
<?php

/* $Id$ */
include 'SabreAMF/Client.php';
//Include the client scripts
$client = new SabreAMF_Client('http://localhost/server.php');
// Set up the client object
$result = $client->sendRequest('myService.myMethod', new SabreAMF_AMF3_Wrapper(array('myParameter')));
//Send a request to myService.myMethod and send as only parameter 'myParameter'
var_dump($result);
//Dump the results
<?php

include 'SabreAMF/Client.php';
// change this to whatever drupal instalation path is on your
// development/production webserver.
// this test only sends and receives back what it sends from a
// predefined sabreamf_pingme service method.
// it behaves like a normal flash/flex application
// (useful when crossdomain.xml madness is above your pattience)
$gateway_url = 'http://localhost/drupal/services/sabreamf';
$sabreamf = new SabreAMF_Client($gateway_url);
$object = new stdClass();
$object->int_value = 10;
$object->float_value = 1.123456;
$object->datetime_value = date_create(date('Y-m-d'));
$object->string_value = 'this is a string';
$object->boolean_value = TRUE;
$object->array_value = array('a', 'b', 'c');
$parameter = array('int_value' => 10, 'float_value' => 1.123456, 'datetime_value' => date_create(date('Y-m-d')), 'string_value' => 'weee', 'boolean_value' => TRUE, 'array_value' => array('a', 'b', 'c'), 'object_value' => $object);
try {
    $sabreamf_result = $sabreamf->sendRequest('sabreamf_server.sabreamf_pingme', new SabreAMF_AMF3_Wrapper(array($parameter)));
    var_dump($sabreamf_result);
} catch (Exception $ex) {
    echo "\n  ERROR - {$gateway_url} - may not point to a valid gateway.\n\n  ";
    echo $ex->getMessage() . "\n";
}
Example #5
0
 //Send a request to myService.myMethod and send as only parameter 'myParameter'
 if (empty($result2[0])) {
     $resultado['msj'] = "Error de conexion.";
     $resultado['success'] = false;
     $usuarioEventos = array();
     //die();
 } else {
     if (count($result2) > 1) {
         foreach ($result2 as $evento) {
             $usuarioEventos[] = $evento->getAmfData();
         }
     } else {
         $usuarioEventos[] = $result2[0]->getAmfData();
     }
 }
 $client3 = new SabreAMF_Client('https://www.uncaminoalsol.org.ar/common/gateway.php');
 // Set up the client object
 $result3 = $client3->sendRequest('clsEventosGlobales.getLast', array());
 //Send a request to myService.myMethod and send as only parameter 'myParameter'
 if (empty($result3)) {
     $eventoGlobal = array('descripcion' => '');
     //die();
 } else {
     $eventoGlobal = $result3->getAmfData();
 }
 $resultado['success'] = true;
 $resultado['eventoGlobal'] = $eventoGlobal['descripcion'];
 $resultado['access_token'] = $_REQUEST['access_token'];
 $resultado['notificaciones'] = $usuarioEventos;
 $resultado['usuario'] = $usuarioData;
 echo json_encode($resultado);
Example #6
0
<?php

/* $Id$ */
include 'SabreAMF/Client.php';
//Include the client scripts
$client = new SabreAMF_Client('http://localhost/server.php');
// Set up the client object
$result = $client->sendRequest('myService.myMethod', array('myParameter'));
//Send a request to myService.myMethod and send as only parameter 'myParameter'
var_dump($result);
//Dump the results