[ previous ] [ next ] [ threads ]
 
 From:  "Ramon A. Darrow" <rdarrow at worrad dot com>
 To:  <m0n0wall at lists dot m0n0 dot ch>
 Subject:  RE: Running command line PHP script
 Date:  Sat, 18 Mar 2006 22:32:27 -0600
> Let's see your PHP script /tmp/everydns-update.php

This is what is in /tmp/everydns-update.php:

#!/usr/local/bin/php
<?php 
$username = '**************';
$password = '**************';
$domain = '**************';

$auth = base64_encode("$username:$password");

$targethost = 'dyn.everydns.net';
$targetport = 80;
$version = '0.1';
$path = "/index.php?ver=$version&domain=$domain";

$timeout = 30;

$fp = fsockopen($targethost, $targetport, $errno, $errstr, $timeout);
if (!$fp) {
	echo "$errstr ($errno)<br />\n";
} else {
	$out = "GET $path HTTP/1.0\r\n";
	$out .= "User-Agent: everydns-update.php $version\r\n";
	$out .= "Host: $targethost\r\n";
	$out .= "Authorization: Basic $auth\r\n\r\n";

	echo $out;

	fwrite($fp, $out);
	while (!feof($fp)) {
		echo fgets($fp, 128);
	}
	fclose($fp);
}
?>