[Red5] interacting with php

Daniel Rossi spam at electroteque.org
Tue Nov 6 15:28:55 PST 2007


Hey there is a tonne of options, there is now a hessian client for  
the hessian remote services in PHP, not sure if its PHP5 OO based  
though. There is yes always soap and rpc PEAR classes for remoting.  
There is also the SabreAMF client for AMF connections.

On 07/11/2007, at 10:19 AM, Dan Brent wrote:

> Here is a php class that I used to remote into Red5.
> It depends on using XML::RPC from PEAR.
> I have deleted all of my specific code and given an example.
> For the example, it assumes there is a fumction in your webapp with a
> declaration like:  test(string,string,string,int).
> Be sure to add your wepapp name to the red5.php (For my purposes it  
> was a
> constant - really should be moved to a parameter)
> Hope this helps.
>
> -Dan
>
> Test program:
> <?php
>
> require_once("red5.php");
>
> $r5 = new red5Remote();
> $r5->setServer("http://YOUR.SERVER.HERE","5080");
>
> if($r5->test("id","sname","fname",10)) {
>         $data = $r5->getResponseData();
>         print_r($data);
> } else {
>         echo ($r5->getErrorString());
>         return;
> }
>
> ?>
>
>
> Red5.php:
>
> <?php
> require_once("XML/RPC.php");
>
>
> class red5Remote {
>   private $server;
>   private $resp;
>
>
>   public function test($id,$streamName,$filename,$duration) {
>     $msg = new XML_RPC_Message('streams.recordBroadcast', array());
>     $msg->addParam(new XML_RPC_Value($id));
>     $msg->addParam(new XML_RPC_Value($streamName));
>     $msg->addParam(new XML_RPC_Value($filename));
>     $msg->addParam(new XML_RPC_Value($duration,int));
>     return($this->sendMsg($msg));
>   }
>
>
>   public function setServer($url,$port) {
>     $this->resp = undef;
>     $this->server = new XML_RPC_Client('/YOUR_WEBAPP_NAME_HERE/ 
> remote',
> $url,$port);
>     //$this->server->setCredentials ('admin','admin');
>     //$this->server->setDebug(1);
>   }
>
>   private function sendMsg($msg) {
>     $this->resp = $this->server->send($msg);
>     if($this->getResultCode() == 0)
>       return(true);
>     return(false);
>   }
>
>   public function getResultCode() {
>     return $this->resp->faultCode();
>   }
>
>   public function getErrorString() {
>     return $this->resp->faultString();
>   }
>
>   public function getResponseData() {
>     return XML_RPC_decode($this->resp->value());
>   }
> }
> ?>
>
>
>
> -----Original Message-----
> From: red5-bounces at osflash.org [mailto:red5-bounces at osflash.org] On  
> Behalf
> Of Eric C
> Sent: Tuesday, November 06, 2007 12:09 PM
> To: red5
> Subject: [Red5] interacting with php
>
> Does anyone have a php code snipit that can call a method and get a
> return value from red5?
>
> Thanks,
>
>  -Eric
>
> _______________________________________________
> Red5 mailing list
> Red5 at osflash.org
> http://osflash.org/mailman/listinfo/red5_osflash.org
>
>
>
> _______________________________________________
> Red5 mailing list
> Red5 at osflash.org
> http://osflash.org/mailman/listinfo/red5_osflash.org




More information about the Red5 mailing list