AMF-Connection

 view release on metacpan or  search on metacpan

examples/amfclient.pl  view on Meta::CPAN

        my $foo = $_."::TO_JSON";
        # unbless
        *$foo = sub {
            $_[0]->{'externalizedData'};
          }
      } (
          'flex.messaging.io.ArrayCollection'
        );
  }

my $endpoint = 'http://swxformat.org/php/amf.php';
my $service = 'Twitter';
my $method = 'search';

my $client = new AMF::Connection( $endpoint );

$client->setEncoding(3);
#$client->setHTTPProxy('http://127.0.0.1:8888');
#$client->addHeader( 'serviceBrowser', 'true' );
$client->setHTTPCookieJar( HTTP::Cookies->new(file => "/tmp/lwpcookies.txt", autosave => 1, ignore_discard => 1 ) );

my $params = [  "italy" ];
my ($response) = $client->call( $service.'.'.$method, $params );

my $json = JSON->new;
$json->ascii(1);
$json->utf8(1);
$json->pretty(1);
$json->allow_blessed(1);
$json->convert_blessed(1);
my $json_data = $json->encode( $response->getData );

if ( $response->is_success ) {
        print $json_data;
} else {
        die "Can not send remote request for $service.$method method with params on $endpoint using AMF".$client->getEncoding()." encoding:\n".$json_data."\n";
        };

examples/get-brightcove-videos-metadata.pl  view on Meta::CPAN

        my $foo = $_."::TO_JSON";
        # unbless
        *$foo = sub {
            $_[0]->{'externalizedData'};
          }
      } (
          'flex.messaging.io.ArrayCollection'
        );
  }

my $endpoint = 'http://c.brightcove.com/services/amfgateway';
my $service = 'com.brightcove.templating.TemplatingFacade';
my $method = 'getContentForTemplateInstance';

my $client = new AMF::Connection( $endpoint );

# $client->config( ... ); # LWP::UserAgent extra params (proxy, auth etc... )

#$client->setEncoding(3);
#$client->setHTTPProxy('http://127.0.0.1:8888');
#$client->setHTTPCookieJar( HTTP::Cookies->new(file => "/tmp/lwpcookies.txt", autosave => 1, ignore_discard => 1 ) );

# eg taken from http://link.brightcove.com/services/player/bcpid34762914001?bctid=672454611001
# works only with AMF0 encoding - at least it seems so - because using openamf ?
#

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.196 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )