Sponsored Content
Full Discussion: Perl HTTP::Tiny
Top Forums Shell Programming and Scripting Perl HTTP::Tiny Post 302977929 by azdps on Saturday 23rd of July 2016 05:35:07 PM
Old 07-23-2016
All the following are working solutions to reboot the ARRIS SURFboard SB6183 cable modem:

Using curl
Code:
curl -d Rebooting=1 http://192.168.100.1/goform/RgConfiguration

Using wget
Code:
wget --quiet -O /dev/null --post-data=Rebooting=1 http://192.168.100.1/goform/RgConfiguration

Using HTTP:Tiny module included in Perl (one liner which can be used at a command prompt)
Code:
perl -MHTTP::Tiny -E 'HTTP::Tiny->new->post_form("http://192.168.100.1/goform/RgConfiguration", { Rebooting => 1 })'

Using a Perl script
Code:
#!/usr/bin/perl 
 
use strict; 
use warnings; 
use HTTP::Tiny; 
 
my $url       = 'http://192.168.100.1/goform/RgConfiguration'; 
my $form_data = { Rebooting => 1 }; 
my $http      = HTTP::Tiny->new; 
my $response  = $http->post_form($url, $form_data); 
 
if ( $response->{success} ) { 
    print "Modem rebooted\n"; 
} 
else { 
    print "Reboot failed: ", $response->{reason}, "\n"; 
}


Thanks to FishMonger for his help over at the http://perlguru.com forums. Smilie
.
.

Last edited by azdps; 07-23-2016 at 06:52 PM..
 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Assistance with Perl and HTTP

I need to query a http site and then parse the xml results, this works well if I use the string in IE but I require an automated solution. I have tried using the following as well as HTTP::Request, nothing seems to work any suggestions would be appreciated, I have tried diffrnt things I found on... (7 Replies)
Discussion started by: bryanthomas
7 Replies

2. Shell Programming and Scripting

Perl Http Post over SSL

Hello, I'm using a tunnel broker for tunneling IPv6 traffic, as my ISP does not support it natively. As of recent i switched from Hurricane Electrics tunnel broker to Sixxs. Whenever my IP address changes, i have to manually log in and change it. This is a bit cumbersome so i was thinking of... (0 Replies)
Discussion started by: regexp
0 Replies

3. Shell Programming and Scripting

awk script to find time difference between HTTP PUT and HTTP DELETE requests in access.log

Hi, I'm trying to write a script to determine the time gap between HTTP PUT and HTTP DELETE requests in the HTTP Servers access log. Normally client will do HTTP PUT to push content e.g. file_1.txt and 21 seconds later it will do HTTP DELETE, but sometimes the time varies causing some issues... (3 Replies)
Discussion started by: Juha
3 Replies
IO::All::HTTP(3pm)					User Contributed Perl Documentation					IO::All::HTTP(3pm)

NAME
IO::All::LWP - Extends IO::All to HTTP URLs SYNOPSIS
use IO::All; $content < io('http://example.org'); # GET webpage into scalar io('http://example.org') > io('index.html'); # GET to file "hello " > io('http://example.org/index.html'); # PUT webpage # two ways of getting a page with a password: $content < io('http://me:secret@example.org'); $content < io('http://example.org')->user('me')->password('secret'); DESCRIPTION
This module extends IO::All for dealing with HTTP URLs. Note that you don't need to use it explicitly, as it is autoloaded by IO::All whenever it sees something that looks like an HTTP URL. The SYNOPSIS shows some simple typical examples, but there are many other interesting combinations with other IO::All features! For example, you can get an HTTP URL and write the content to a socket, or to an FTP URL, of to a DBM file. METHODS
This is a subclass of IO::All::LWP. The only new method is "http", which can be used to create a blank IO::All::HTTP object; or it can also take an HTTP URL as a parameter. Note that in most cases it is simpler just to call io('http://example.com'), which calls the "http" method automatically. OPERATOR OVERLOADING
The same operators from IO::All may be used. < GETs an HTTP URL; > PUTs to an HTTP URL. SEE ALSO
IO::All, IO::All::LWP, LWP. AUTHORS
Ivan Tubert-Brohman <itub@cpan.org> and Brian Ingerson <ingy@cpan.org> COPYRIGHT
Copyright (c) 2007. Ivan Tubert-Brohman and Brian Ingerson. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/perl/misc/Artistic.html> perl v5.10.0 2007-03-29 IO::All::HTTP(3pm)
All times are GMT -4. The time now is 09:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy