<?php

/*
Script Name: YIPChange

Author: Eric O'Callaghan (eric@ericoc.com)

I have no affiliation with the people who run
YI.org's Dynamic DNS service. I just like the
service and made the script because my IP kept
changing and I was tired of going to their site
every few days to update it.

This script simply changes the IP address for your
YI.org hostname to the IP address of the machine
that runs it. It should probably be set up as a cron
job to be run every few minutes/hours, but you could
just manually run it whenever your machine's IP address
happens to change.

This should work on any of YI.org's dynamic DNS hostnames,
not just .yi.org, but also .whyi.org and others.

The cURL module must be installed and/or compiled into
PHP for this script to work.

http://ericoc.com/set-hostname.phps

*/

##################
# EDIT VARIABLES #
##################

// Enter the YI.org hostname you want to change
$hostname "domain.yi.org";

// Enter your YI.org account password
$password "abc123";

############################
# BE CAREFUL EDITING BELOW #
############################

// Start cURL
$ch curl_init();

// Set the target URL where we send the request to change address
curl_setopt($chCURLOPT_URL"http://www.yi.org/bin/dyndns.fcgi");

// Set the hostname and account password
curl_setopt($chCURLOPT_USERPWD"$hostname:$password");

// Get the result
$result curl_exec($ch);

// Close cURL
curl_close($ch);

// Show the result
echo $result;

?>