Bug #7206 » r53-dyndns-clean.php
1 |
<?php
|
---|---|
2 |
|
3 |
include_once("r53.class"); |
4 |
|
5 |
function log_error($l){ |
6 |
printf("LOG: %s\n", $l); |
7 |
return true; |
8 |
}
|
9 |
|
10 |
|
11 |
main: |
12 |
|
13 |
# Pass this your public and private keys
|
14 |
$r53 = new Route53("PUBKEY","PRIVKEY"); |
15 |
$apiurl = $r53->getApiUrl("ZONEID"); |
16 |
$xmlreq = $r53->getRequestBody("domain.example.com", "8.8.8.8", "3600","A"); |
17 |
log_error(sprintf("XMLHASH:%s", hash("sha256",$xmlreq))); |
18 |
$httphead = $r53->getHttpPostHeaders("ZONEID", "us-east-1", hash("sha256",$xmlreq)); |
19 |
|
20 |
if(true){ |
21 |
log_error(sprintf("Sending reuquest to: %s", $apiurl)); |
22 |
foreach($httphead as $hv){ |
23 |
log_error(sprintf("Header: %s", $hv)); |
24 |
}
|
25 |
log_error(sprintf("XMLPOST: %s", $xmlreq)); |
26 |
}
|
27 |
|
28 |
|
29 |
$ch = curl_init(); |
30 |
curl_setopt($ch, CURLOPT_URL, $apiurl); |
31 |
curl_setopt($ch, CURLOPT_HTTPHEADER, $httphead); |
32 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlreq); |
33 |
|
34 |
print curl_exec($ch); |
35 |
print "\n"; |
36 |
curl_close($ch); |
37 |
|
38 |
?>
|