Community discussions

MikroTik App
 
RabbitAtNet
just joined
Topic Author
Posts: 18
Joined: Fri Dec 11, 2009 12:16 am

Fetch command - What can and can't it do?

Fri Dec 11, 2009 1:00 am

Hi guys,

at the moment I am working on two scripts in parallel. While one is supposed to update my DNS entry at no-ip.com the other should keep my public IP current with tunnelbroker.com. Both services offer API's via http, so the fetch command seems ideal to get the job done. However, it has occured to me, that it is not as simple as it sounds.

For the tunnnelbroker service offered by Hurricane Electric, I need to access the following URL:
http://ipv4.tunnelbroker.net/ipv4_end.php?ipv4b=78.53.216.104&pass=SOME-MD5-HASH&user_id=SOME-LARGE-CRYPTIC-NUMBER&tunnel_id=40298
So I tried from the command line just to get the http command working:
/tool fetch mode=http port=80 address=ipv4.tunnelbroker.net host=ipv4.tunnelbroker.net src-path="/ipv4_end.php?ipv4b=78.53.216.104&pass=pass=SOME-MD5-HASH&user_id=SOME-LARGE-CRYPTIC-NUMBER&tunnel_id=40298"
Unfortunately, it did not.

For the no-ip.com domain services the story becomes even more complicated. While the URL I have to call is straight forward (http://dynupdate.no-ip.com/nic/update?hostname=babylon5.hopto.org) the page requires basic http authentication. So I tried to pass along that information with the fetch command.
/tool fetch mode=http port=80 address=dynupdate.no-ip.com host=dynupdate.no-ip.com src-path="/nic/update?hostname=babylon5.hopto.org" user=some-username password=some-password
My point being is, that the fetch command can be quite complex. Is there a documentation, example ... how this command was intended to be used? What parameter combinations actually make sense? What are the limitations of the fetch command? - Any advice is appreciated!

Greetings from Germany,
Rabbit@Net
-----------------------
Running RouterOS 4.3 on RB450G
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Fetch command - What can and can't it do?

Fri Dec 11, 2009 1:48 am

try just
/tool fetch url="http://dynupdate.no-ip.com/...."
 
RabbitAtNet
just joined
Topic Author
Posts: 18
Joined: Fri Dec 11, 2009 12:16 am

Re: Fetch command - What can and can't it do?

Sun Dec 13, 2009 10:02 pm

Hi Chipaka,

thanks for the tip. Unfortunately it did not do the trick. A simple test with
/tool fetch url="http://www.google.de/index.html"
worked fine. However, I receive an error 404 when I use
/tool fetch url="http://ipv4.tunnelbroker.net/ipv4_end.php"
. Are there some parameters I can use to fix this?

Greetings from Germany,
Rabbit@Net
 
hedele
Member
Member
Posts: 338
Joined: Tue Feb 24, 2009 11:23 pm

Re: Fetch command - What can and can't it do?

Sun Dec 13, 2009 10:27 pm

Maybe try using it like this?

/tool fetch url="http://username:password@website.net/somesite.htm" for stuff that requires authentication.
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Fetch command - What can and can't it do?

Sun Dec 13, 2009 10:47 pm

/tool fetch host="ipv4.tunnelbroker.net" url="http://ipv4.tunnelbroker.net/ipv4_end.php"
works for me.

ipv4.tunnelbroker.net appears to not serve unless the HTTP request specifies a "Host:" parameter.
 
RabbitAtNet
just joined
Topic Author
Posts: 18
Joined: Fri Dec 11, 2009 12:16 am

Re: Fetch command - What can and can't it do?

Sun Dec 13, 2009 11:19 pm

*Arrghh* - jepp, it is working fine.

I'll port my script as soon as its done. Thanks to you all!
 
TonyJr
Member Candidate
Member Candidate
Posts: 207
Joined: Sat Nov 12, 2011 1:30 am
Location: UK
Contact:

Re: Fetch command - What can and can't it do?

Wed Jan 11, 2012 8:00 am

Hi RabbitAtNet,

Are you able to share your two (DNS and HE.net) update scripts at all, please? I'm struggling quite a bit to get the scripts already posted in the Forum and Wiki going.

Thanks,

Tony

Who is online

Users browsing this forum: No registered users and 14 guests