473,409 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Downloading a file using http

Hi, i need to download a file using perl from a website. The link contains the file name so this is complete file address. Earlier i was able to do it using LWA as the file content could be viewed in the browser itself but now when i open the link in my internet browser its asking me to save the file so not showing the content of the file there itself. Could you please tell me how to handle it.
Thanks!
Jul 17 '10 #1
5 2525
gpraghuram
1,275 Expert 1GB
You can try using curl executable (in windows) or wget (In unix).
Call this from a Perl program and you can easily download the file.

Raghu
Jul 20 '10 #2
Hi Raghu,
Is there any possibility if i have the link of a website and that web page contains multiple links with different names. And i want to access any of them. I am trying this in unix.
Thanks!
Jul 20 '10 #3
RonB
589 Expert Mod 512MB
See:
HTML::LinkExtor - Extract links from an HTML document
http://search.cpan.org/~gaas/HTML-Pa...L/LinkExtor.pm

and:
LWP::Simple - simple procedural interface to LWP
http://search.cpan.org/~gaas/libwww-.../LWP/Simple.pm
Jul 20 '10 #4
Jyoti Ballabh
115 100+
You could make a system call to linux and read the input. This puts a bit more load on your computer and should not be used if you are going to retrieve many documents. You have more control and a more efficient solution using the LWP package (second part in the code below).



# invoking lynx

$html_code = `lynx -source http://www.yahoo.com/`;
$text_data = `lynx -dump http://www.yahoo.com/`;

# using LWP

use LWP::Simple;
$content = get('http://www.yahoo.com');
Jul 24 '10 #5
numberwhun
3,509 Expert Mod 2GB
@Jyoti-Ballabh It sounds like the OP wants to download a file, not the page itself.

My recommendation would be to use the WWW::Mechanize module to download the file. I wrote a similar script using this module a few years ago and use it to this day.
Jul 31 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: ASP Spam Fighter | last post by:
Curt_C Wrote: > open the request in a new window That would work fine for me, but I'm writing this script for people who believe that we must assume total and utter user stupidity. Since this...
1
by: Mark | last post by:
Hello. How can I download some file from HTTP (for example "http://www.mysite.com/files/myfile.doc") and then save it to my local drive (for example "C:\MyFiles\myfile.doc")? Thank you.
3
by: Jocelyn Duhaylungsod | last post by:
I have been getting the following server errors sporadically while downloading excel, csv or xml file. Internet Explorer cannot download <file name> from <IP address> "The server returned an...
0
by: brian.fairchild | last post by:
I have a downloader page in my asp.net application that looks at a session variable to get the path to the file, checks it then downloads it using the Response object. When the "File Download"...
4
by: Richard L Rosenheim | last post by:
I know that I can download a file from a web server by using the WebClient.DownloadFile method. But, does anyone know of an example of downloading a file from a web server with the ability to...
4
by: M. Noroozi Eghbali | last post by:
Hi, I need to download a file using OnClick event or Command of a ASP button. Is there any possible code for this? In ASPX file: <ASP:Button id="button1" runat="server" text="Start...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
6
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I'm trying to download a binary ZIP file using HTTP. Following an example in MSDN and other sources, my code is: WebClient client = new WebClient();...
7
by: raids51 | last post by:
Hello, i have a program that downloads a file using the httpwebrequest/response, and it usually works, but sometimes it will freeze at a random part of the download without an error. here is the...
2
by: kprawin | last post by:
Hai everybody, Im trying to upload an image using a form by using POST method and another PHP file to receive and upload the file. I used the following lines of code and it shows some error and...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.