Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

authentication using amfphp

Avatar

Level 1

Hi

I need to get a token back to my basic chat program and wanted to use amfphp.

I tried to test the class in the amfphp/browser but it doesn't work.

When I run the code from the command line it just pumps out

php chatter.php
usage: chatter.php [--debug] [--host=hosturl] account username password
         --list
         --create room [template]
         --delete room
         --delete-template template
         --ext-auth secret room username userid role
         --invalidate room

It's actually require_once("afcs.php"); thats causing it. I guess I should study the code but was wondering if it is possible to use amfphp without reworking loads of stuff.

I know that in the index.php that comes with the examples, the afcs.php is obviously used but something is supressing the "usage" output.

I've pasted my amfphp class below. I've tried moving the contructor content to the function also but it's not working still.

<?php
require_once("afcs.php");

class chatter
{
  
   public function __construct()
   {  // obviously deleted
     $account = "";
     $room    = "";
     $devuser = "";
     $devpass = "";
     $secret  = "";
   }

   function getchat($screen_name,$room)
   {
     $role = 5;
     session_start();
     $host  = "http://connectnow.acrobat.com";
     $accountURL = "{$host}/{$account}";
     $roomURL = "{$accountURL}/{$room}";
     $am = new AFCSAccount($accountURL);
     $am->login($devuser, $devpass);
     $session = $am->getSession($room);
     $token = $session->getAuthenticationToken($secret, $user, $user, $role);
     return $token;
    }


}?>
~
~

Many thanks

Kevin

0 Replies

Avatar

Employee

The reason you get the "usage" message is because I tried to be smart and have afcs.php act both as a loadable module and a standalone application, but I don't seem to find the right combination of tests that works reliably. Maybe for next revision of the SDK I should just give up and split the code in two.

In the mean time for your use just delete the very last block of code, where it says:

if (!isset($_SERVER['QUERY_STRING'])) {

...

}