2010-09-17 28 views
0

我不能让API xmlrpc与浏览器镜头一起工作,它真的很烦人。 第一种方法 $ method ='nonces.challenge'; http://api.browsershots.org/xmlrpc/nonces.challenge/有没有人有API与浏览器一起工作?

我该如何获得它的意思是它似乎只是针对我的主机名。

的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); 

它说我缺少一个。我哪里错了?

回答

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); 

你需要一个付费帐户获得的截图这种方式。

+0

哦,我没有。感谢您的输入 - 我发现另一个网站给了我想要的结果。 – 2010-09-20 11:53:27

+0

是一个很好的http://www.shrinktheweb.com/auth/stw-lobby,只要你不太经常ping它,它就是免费的。 感谢您的输入 – 2010-09-20 11:54:08

相关问题