我无法让API xmlrpc与浏览器镜头一起使用它真的很烦人。 第一种方法 $ method ='nonces.challenge'; http://api.browsershots.org/xmlrpc/nonces.challenge/
我如何获得它对我来说意味着什么的主机名。
nonces.verifyUser说它需要2个输入而我正在使用
$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);
它说我错过了一个。我哪里错了?
答案 0 :(得分:2)
我希望你能理解我的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);
您需要一个付费帐户才能以这种方式获取屏幕截图。