Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Network Outlet

by Khen1950fx (Canon)
on Apr 29, 2012 at 03:12 UTC ( #967890=note: print w/replies, xml ) Need Help??

in reply to Network Outlet

I encountered problems with URI::Escape, so I reworked your script to make it a little simpler. I used LWP::UserAgent instead of LWP::Simple and used ":content_file => " to make a file.
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use URI::Escape; print "Enter an URL and Press Enter: \n"; my $url = <ARGV>; my $ua = LWP::UserAgent->new; my $response = $ua->get( $url, ':content_file' => '/root/Desktop/url.log', ); die "Couldn't get $url" unless defined $response; if ($response->is_success) { print $response->decoded_content; } else { die $response->status_line; } my $videoURL = uri_escape_utf8($url); my $new_videoURL = uri_unescape($videoURL); print $new_videoURL ;
This is only a skeleton, but I think that you could usefully build upon it.

Updated: Revised. Thanks to jwkrahn for catching the mistake.

Replies are listed 'Best First'.
Re^2: Network Outlet
by jwkrahn (Monsignor) on Apr 29, 2012 at 06:53 UTC
    my $url = <ARGV>;

    Why change STDIN to ARGV?    And either way you still have to chomp the value received.

    while ($new_videoURL) { chomp; print $new_videoURL ; }

    Does $new_videoURL assign a value to $_?    And if not then why are you chomping the $_ variable?    And if the value in $new_videoURL doesn't change inside the loop then why are you using a loop at all?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://967890]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2018-03-19 06:06 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (232 votes). Check out past polls.