Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Help with this code please

Posted by JuDaS (JuDaS), 28 January 2005
Hi, Im new with perl, anyway Im trying to make a script that logs me into a web and then regsiter my ip address, Im mean, is a free domain but i have a dynamic Ip and needs to be modify everytime I get "connected".
I have made this already, but it never gets "updated", i don't know what Im doing wrong, any help?.
Thanks in advance.
Here is the code
     
Code:
#!/usr/bin/perl
use WWW::Mechanize;
use HTTP::Cookies;
my $url = "https://www.dyndns.org/services/dyndns/myweb";
my $username = "username";
my $password = "password";
my $agent =WWW::Mechanize->new();
$agent->cookie_jar(HTTP::Cookies->new);
$agent->get($url);
$agent->form(1);
$agent->field("username", $username);
agent->field("password", $password);
$$agent->click();
my $stream = HTML::TokeParser->new(\$agent->{content});
my $old_ip;
my $new_ip;
$stream->get_tag("input");
$stream->get_tag("table");
$stream->get_tag("tr");
$stream->get_tag("td");
$stream->get_tag("td");
$old_ip = $stream->get_trimmed_text("/td");
print "The IP in base is: ($old_ip) \n";
$stream->get_tag("tr");
$stream->get_tag("td");
$stream->get_tag("td");
$new_ip = $agent->field("ip");
print "The new IP is: ($new_ip) \n";
$agent->click_button(value =>"Modify Host");
       print "Done!! \n";



I get the "Done!!" messega, but the registry is not updated, any idea why?
Thanks
The form is like this
Code:
<td valign="top">
           <input type="submit" name="action" value="Modify Host" />& nbsp;
           <input type="submit" name="action" value="Delete Host" />& nbsp;
           <input type="reset" value="Reset Form" />
     </td>


Maybe is a problem with the  "nbsp; "  if it is, how can i get rid of that?


Posted by admin (Graham Ellis), 29 January 2005
Question noted.  Nedd to get back to base to look at this one (I'm  on the road at the moment).  Please post a follow up if you get it sorted in the meantime, or confirm tomorrow morning that the problem's still unresolved and I'll take a look. - Graham



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2012: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho