UPDATE IP DYNDNS USING CURL PHP


[root@DUREN3REPO ~]# vim no-ip.sh

#!/bin/bash
/usr/bin/links http://www.checkip.org/ | grep “Your IP Address:”|awk -F’:’ ‘{print $2}’ > /tmp/ip.txt
ip_address=`cat /tmp/ip.txt`
CDIR=`pwd`
/usr/bin/php ${CDIR}/update-ip.php $ip_address

[root@DUREN3REPO ~]# vim update-ip.php
<?php
$myip=trim($argv[1]);
$username = “gozigomilis@gmail.com”;
$password = “mypassword”;
//https://www.noip.com/members/dns/host.php?host_id=30961953
//https://www.noip.com/members/dns/
$url      = “https://dynupdate.no-ip.com/nic/update?hostname=mydomain.no-ip.info&myip=${myip}”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERPWD, “$username:$password”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
print $output;
?>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

shisdew

Listens until think alike

moses.spaceku@yahoo.com / voip ipbx

Hosted PBX, IP-PBX SOHO/ CALL CENTER, VOICE GATEWAY, VOICE CARD, COST EFECTIVE SOLUTIONS (LCR), GSM/CDMA GATEWAY

%d bloggers like this: