views:

22

answers:

1

I can't get the API xmlrpc to work with browser shots its really annoying. The first method $method = 'nonces.challenge'; http://api.browsershots.org/xmlrpc/nonces.challenge/

How do I get the hostname that it meantions it seems just against me.

The nonces.verifyUser says it needs 2 inputs and I'm using

$params = array();
$params[username] = 'username';
$params[encrypted_password] = 'password';


$request = xmlrpc_encode_request  ($method  ,  $params);
echo "<pre>";
print_r($request);
echo "</pre>";

$context = stream_context_create(array('http' => array(
    'method' => "POST",
    'header' => "Content-Type: text/xml",
    'content' => $request
)));

echo "<pre>";
print_r($context);
echo "</pre>";

$file = file_get_contents($browser_shots_url, false, $context);

print_r($file);

adn it says I'm missing one where am I going wrong?

Thanks for anyones help. I have to say the documentation is really basic and I'm just lost. Richard

+1  A: 

Hello,

I hope you can grok my perl:

#!/usr/bin/perl
# Documentation at: http://api.browsershots.org/xmlrpc/
# Or through the system.listMethods and system.methodHelp <method> calls
use strict;
use warnings;
use RPC::XML;
use RPC::XML::Client;
use Data::Dumper;
use Digest::MD5 qw(md5_hex);
use Digest::SHA1 qw(sha1_hex);

my $cli = RPC::XML::Client->new('http://api.browsershots.org/xmlrpc/');

my $resp = $cli->send_request('nonces.challengeUser','USERNAME');
my $pw_hash;
if ($resp->{algorithm}->value eq "sha1") {
    $pw_hash = sha1_hex($resp->{salt}->value."PASSWORD");
} else {
    warn "md5 algorithm";
}
my $verify_string = md5_hex($pw_hash.$resp->{nonce}->value);
print "$verify_string\n";
my $login = $cli->send_request('nonces.verifyUser','USERNAME',$verify_string);
my $browsers = $cli->send_request('browsers.active');
$resp = $cli->send_request('nonces.challengeUser','USERNAME');
$pw_hash = sha1_hex($resp->{salt}->value."PASSWORD");
$verify_string = md5_hex($pw_hash.$resp->{nonce}->value);
my $screq = $cli->send_request('requests.submit','xssmirror',$verify_string,'http://www.domain.com','');
print Dumper($screq);

You'll need a paid account to obtain screenshots this way.

Johnny Fingers
Oh, I don't have one. Thanks for the input - I found another site that gave me the results I wanted.
Richard Housham
is a a good one http://www.shrinktheweb.com/auth/stw-lobby and it is free as long as you don't ping it too often.Thanks for your input
Richard Housham