FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184016] Mon, 02 December 2013 17:21 Go to next message
zhangfj is currently offline  zhangfj
Messages: 5
Registered: December 2013
Karma: 0
Junior Member
Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ?
I mean not manually.
I can download the file in these kind address, manually. There is a button in the web page, and the web url change to "http://***.com/down.php" once the button is clicked.

I have no idea about download it through programming.(Thus they may be downloaded automatically.)
Is that possible ?

Any comment is appreciated. Thanks in advance.
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184017 is a reply to message #184016] Mon, 02 December 2013 17:25 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 12/2/2013 12:21 PM, zhangfj(at)gmail(dot)com wrote:
> Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ?
> I mean not manually.
> I can download the file in these kind address, manually. There is a button in the web page, and the web url change to "http://***.com/down.php" once the button is clicked.
>
> I have no idea about download it through programming.(Thus they may be downloaded automatically.)
> Is that possible ?
>
> Any comment is appreciated. Thanks in advance.
>

You should be able to use cURL to download the file. Not having exact
detail on what's happening, but I would suggest you use Firefox's Live
HTTP Headers to see what's being sent to the server. That might give
you some ideas.

There's also a possibility the site uses javascript to download the
file; this would be harder but you should still be able to determine
what's being sent to the server to download the file.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184018 is a reply to message #184016] Mon, 02 December 2013 17:31 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Mon, 02 Dec 2013 09:21:12 -0800, zhangfj wrote:

> Can I download file with address like this
> "http://***.com/file.php/ABC.html" automatically ?
> I mean not manually.
> I can download the file in these kind address, manually. There is a
> button in the web page, and the web url change to
> "http://***.com/down.php" once the button is clicked.
>
> I have no idea about download it through programming.(Thus they may be
> downloaded automatically.)
> Is that possible ?
>
> Any comment is appreciated. Thanks in advance.

As you asked the question in a php newsgroup, I assume you wish to use php
code to retrieve The term you need to google may be "php curl".

However, as a simpler interface, if the php configuration allows it, you
can also use a url as a filename to open a file. What you then do with
the data you receive by reading from the file handle is up to you.

This of course assumes that you know the url that you want to retrieve.

If you're not using php to do the automatic download, you're asking in
the wrong place. How "automatic" do you wish it to be? If you want it to
happen every minute / hour / day / week etc you may wish to look up the
scheduling mechanism on your system (usually cron on a linux/unix etc
box, but I have no idea what you're actually using).

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184019 is a reply to message #184016] Mon, 02 December 2013 18:19 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Mon, 2 Dec 2013 09:21:12 -0800 (PST), zhangfj(at)gmail(dot)com wrote:

> Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ?
> I mean not manually.
> I can download the file in these kind address, manually. There is a button in the web page, and the web url change to "http://***.com/down.php" once the button is clicked.
>
> I have no idea about download it through programming.(Thus they may be downloaded automatically.)
> Is that possible ?
>
> Any comment is appreciated. Thanks in advance.

Not really.
As the convention of the URL does not allow wild cards.
i.e. the ***.
There are several programs available that download numerous pages from
within a single domain. But not the way you want.

However, it could possibly be done using a programmiing language called
liberty basic.
www.libertybasic.com
They have a program where pages can be downloaded automatically.
With a little extra coding, you could have it search through each and every
domain until it finds a matching page and then download it.

Then, if you get caught downloading copyrighted material you can tell us
about your experiences from prison.
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184026 is a reply to message #184017] Tue, 03 December 2013 02:23 Go to previous messageGo to next message
zhangfj is currently offline  zhangfj
Messages: 5
Registered: December 2013
Karma: 0
Junior Member
在 2013年12月3日星期二UTC+8上午1时25分15秒,Jerry Stuckle写道:
> On 12/2/2013 12:21 PM, zhangfj(at)gmail(dot)com wrote:
>
>> Can I download file with address like this "http://***.com/file.php/ABC..html" automatically ?
>
>> I mean not manually.
>
>> I can download the file in these kind address, manually. There is a button in the web page, and the web url change to "http://***.com/down.php" once the button is clicked.
>
>>
>
>> I have no idea about download it through programming.(Thus they may be downloaded automatically.)
>
>> Is that possible ?
>
>>
>
>> Any comment is appreciated. Thanks in advance.
>
>>
>
>
>
> You should be able to use cURL to download the file. Not having exact
>
> detail on what's happening, but I would suggest you use Firefox's Live
>
> HTTP Headers to see what's being sent to the server. That might give
>
> you some ideas.
>
>
>
> There's also a possibility the site uses javascript to download the
>
> file; this would be harder but you should still be able to determine
>
> what's being sent to the server to download the file.
>
>
>
> --
>
> ==================
>
> Remove the "x" from my email address
>
> Jerry Stuckle
>
> JDS Computer Training Corp.
>
> jstucklex(at)attglobal(dot)net
>
> ==================

Thank you. Your reply is the nearest to my objective.
And thanks to other replies.
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184027 is a reply to message #184019] Tue, 03 December 2013 02:43 Go to previous messageGo to next message
zhangfj is currently offline  zhangfj
Messages: 5
Registered: December 2013
Karma: 0
Junior Member
在 2013年12月3日星期二UTC+8上午2时19分51秒,richard写道:
> On Mon, 2 Dec 2013 09:21:12 -0800 (PST), zhangfj(at)gmail(dot)com wrote:
>
>
>
>> Can I download file with address like this "http://***.com/file.php/ABC..html" automatically ?
>
>> I mean not manually.
>
>> I can download the file in these kind address, manually. There is a button in the web page, and the web url change to "http://***.com/down.php" once the button is clicked.
>
>>
>
>> I have no idea about download it through programming.(Thus they may be downloaded automatically.)
>
>> Is that possible ?
>
>>
>
>> Any comment is appreciated. Thanks in advance.
>
>
>
> Not really.
>
> As the convention of the URL does not allow wild cards.
>
> i.e. the ***.
>
> There are several programs available that download numerous pages from
>
> within a single domain. But not the way you want.
>
>
>
> However, it could possibly be done using a programmiing language called
>
> liberty basic.
>
> www.libertybasic.com
>
> They have a program where pages can be downloaded automatically.
>
> With a little extra coding, you could have it search through each and every
>
> domain until it finds a matching page and then download it.
>
>
>
> Then, if you get caught downloading copyrighted material you can tell us
>
> about your experiences from prison.

LOL.

My question maybe mislead you.
I just wanna download materials from one site. And the changing part should be "ABC" in the url, in order to download automatically.
Thanks for your reply.
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184028 is a reply to message #184018] Tue, 03 December 2013 03:10 Go to previous messageGo to next message
zhangfj is currently offline  zhangfj
Messages: 5
Registered: December 2013
Karma: 0
Junior Member
Thank you for your informative reply.

Briefly, my problem is that I can't download the file by programming.
I want to change "ABC" in the URL to download files automatically from one site.
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184029 is a reply to message #184019] Tue, 03 December 2013 06:15 Go to previous messageGo to next message
Evan Platt is currently offline  Evan Platt
Messages: 124
Registered: November 2010
Karma: 0
Senior Member
On Mon, 2 Dec 2013 13:19:51 -0500, richard <noreply(at)example(dot)com>
wrote:

> Not really.
> As the convention of the URL does not allow wild cards.
> i.e. the ***.

You dumbass, the OP was simply munging the domain.

Since you obviously don't understand the question, don't attempt to
answer it.
--
To reply via e-mail, remove The Obvious and .invalid from my e-mail address.
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184030 is a reply to message #184016] Tue, 03 December 2013 06:57 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 02/12/13 18:21, zhangfj(at)gmail(dot)com wrote:
> Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ?
> I mean not manually.
> I can download the file in these kind address, manually. There is a button in the web page, and the web url change to "http://***.com/down.php" once the button is clicked.
>
> I have no idea about download it through programming.(Thus they may be downloaded automatically.)
> Is that possible ?
>
> Any comment is appreciated. Thanks in advance.

Not really a PHP question IMHO, read the man page for wget
http://unixhelp.ed.ac.uk/CGI/man-cgi?wget
It's a tool with which you can download a whole site, parts or what ever
you like.

--

//Aho
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184031 is a reply to message #184028] Tue, 03 December 2013 10:09 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 03/12/13 03:10, zhangfj(at)gmail(dot)com wrote:
> Thank you for your informative reply.
>
> Briefly, my problem is that I can't download the file by programming.
> I want to change "ABC" in the URL to download files automatically from one site.
>

You need to have a link top a PHP program that reads the file, then sets
up headers top tell the browser that it is not (to be understood to be)
an HTML: page, but a file download, and then sends the file.

so if your program was say -getfile.php and the file was 'rubbish.html'

<?php
header("Content-Disposition: attachment; filename=\"rubbish.html\"");
header("Content-Type: text/plain");
$data=file_get_contents("rubbish.html");
echo($data);

and that's it. No closing ?> should be used so there is no danger of
setting characters NOT in the file itself - the script exits still in
'php mode'

in your main page use

<a href="getfile.php">Download the file here</a>

Setting the content-disposition to 'attachment' strongly suggests to the
browser that the contents should not be displayed as HTML but should be
downloaded instead. However this behaviour is never 100% guaranteed.

instead of a local filename you can use a URL as well, if you are trying
to 'scrape' another website.

curl() will give you more control if you need it than
file_get_contents() for that.

http://us1.php.net/manual/en/curl.examples-basic.php


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184034 is a reply to message #184031] Tue, 03 December 2013 13:15 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 12/3/2013 5:09 AM, The Natural Philosopher wrote:
> On 03/12/13 03:10, zhangfj(at)gmail(dot)com wrote:
>> Thank you for your informative reply.
>>
>> Briefly, my problem is that I can't download the file by programming.
>> I want to change "ABC" in the URL to download files automatically from
>> one site.
>>
>
> You need to have a link top a PHP program that reads the file, then sets
> up headers top tell the browser that it is not (to be understood to be)
> an HTML: page, but a file download, and then sends the file.
>
> so if your program was say -getfile.php and the file was 'rubbish.html'
>
> <?php
> header("Content-Disposition: attachment; filename=\"rubbish.html\"");
> header("Content-Type: text/plain");
> $data=file_get_contents("rubbish.html");
> echo($data);
>
> and that's it. No closing ?> should be used so there is no danger of
> setting characters NOT in the file itself - the script exits still in
> 'php mode'
>
> in your main page use
>
> <a href="getfile.php">Download the file here</a>
>
> Setting the content-disposition to 'attachment' strongly suggests to the
> browser that the contents should not be displayed as HTML but should be
> downloaded instead. However this behaviour is never 100% guaranteed.
>
> instead of a local filename you can use a URL as well, if you are trying
> to 'scrape' another website.
>
> curl() will give you more control if you need it than
> file_get_contents() for that.
>
> http://us1.php.net/manual/en/curl.examples-basic.php
>
>

Completely off the mark, as usual.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184035 is a reply to message #184027] Tue, 03 December 2013 13:41 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Mon, 2 Dec 2013 18:43:15 -0800 (PST), zhangfj(at)gmail(dot)com wrote:

> 在 2013年12月3日星期二UTC+8上午2时19分51秒,richard写道:
>> On Mon, 2 Dec 2013 09:21:12 -0800 (PST), zhangfj(at)gmail(dot)com wrote:
>>
>>
>>
>>> Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ?
>>
>>> I mean not manually.
>>
>>> I can download the file in these kind address, manually. There is a button in the web page, and the web url change to "http://***.com/down.php" once the button is clicked.
>>
>>>
>>
>>> I have no idea about download it through programming.(Thus they may be downloaded automatically.)
>>
>>> Is that possible ?
>>
>>>
>>
>>> Any comment is appreciated. Thanks in advance.
>>
>>
>>
>> Not really.
>>
>> As the convention of the URL does not allow wild cards.
>>
>> i.e. the ***.
>>
>> There are several programs available that download numerous pages from
>>
>> within a single domain. But not the way you want.
>>
>>
>>
>> However, it could possibly be done using a programmiing language called
>>
>> liberty basic.
>>
>> www.libertybasic.com
>>
>> They have a program where pages can be downloaded automatically.
>>
>> With a little extra coding, you could have it search through each and every
>>
>> domain until it finds a matching page and then download it.
>>
>>
>>
>> Then, if you get caught downloading copyrighted material you can tell us
>>
>> about your experiences from prison.
>
> LOL.
>
> My question maybe mislead you.
> I just wanna download materials from one site. And the changing part should be "ABC" in the url, in order to download automatically.
> Thanks for your reply.

There are programs out there that will do just that.
Some will even download the entire site!
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184036 is a reply to message #184030] Tue, 03 December 2013 13:50 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Tue, 03 Dec 2013 07:57:10 +0100, J.O. Aho wrote:

> On 02/12/13 18:21, zhangfj(at)gmail(dot)com wrote:
>> Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ?
>> I mean not manually.
>> I can download the file in these kind address, manually. There is a button in the web page, and the web url change to "http://***.com/down.php" once the button is clicked.
>>
>> I have no idea about download it through programming.(Thus they may be downloaded automatically.)
>> Is that possible ?
>>
>> Any comment is appreciated. Thanks in advance.
>
> Not really a PHP question IMHO, read the man page for wget
> http://unixhelp.ed.ac.uk/CGI/man-cgi?wget
> It's a tool with which you can download a whole site, parts or what ever
> you like.

Liberty Basic's urlmon.bas program can do that in a hearbeat.
It pulls the entire page(s) as a single string and saves the file.
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184064 is a reply to message #184031] Wed, 04 December 2013 02:26 Go to previous messageGo to next message
zhangfj is currently offline  zhangfj
Messages: 5
Registered: December 2013
Karma: 0
Junior Member
在 2013年12月3日星期二UTC+8下午6时09分34秒,The Natural Philosopher写道:
> On 03/12/13 03:10, zhangfj(at)gmail(dot)com wrote:
>
>> Thank you for your informative reply.
>
>>
>
>> Briefly, my problem is that I can't download the file by programming.
>
>> I want to change "ABC" in the URL to download files automatically from one site.
>
>>
>
>
>
> You need to have a link top a PHP program that reads the file, then sets
>
> up headers top tell the browser that it is not (to be understood to be)
>
> an HTML: page, but a file download, and then sends the file.
>
>
>
> so if your program was say -getfile.php and the file was 'rubbish.html'
>
>
>
> <?php
>
> header("Content-Disposition: attachment; filename=\"rubbish.html\"");
>
> header("Content-Type: text/plain");
>
> $data=file_get_contents("rubbish.html");
>
> echo($data);
>
>
>
> and that's it. No closing ?> should be used so there is no danger of
>
> setting characters NOT in the file itself - the script exits still in
>
> 'php mode'
>
>
>
> in your main page use
>
>
>
> <a href="getfile.php">Download the file here</a>
>
>
>
> Setting the content-disposition to 'attachment' strongly suggests to the
>
> browser that the contents should not be displayed as HTML but should be
>
> downloaded instead. However this behaviour is never 100% guaranteed.
>
>
>
> instead of a local filename you can use a URL as well, if you are trying
>
> to 'scrape' another website.
>
>
>
> curl() will give you more control if you need it than
>
> file_get_contents() for that.
>
>
>
> http://us1.php.net/manual/en/curl.examples-basic.php
>
>
>
>
>
> --
>
> Ineptocracy
>
>
>
> (in-ep-toc’-ra-cy) – a system of government where the least capable to
>
> lead are elected by the least capable of producing, and where the
>
> members of society least likely to sustain themselves or succeed, are
>
> rewarded with goods and services paid for by the confiscated wealth of a
>
> diminishing number of producers.

Thanks for your information in detail, I can't understand them now. I will pay attention to that website to follow your idea.
Re: Can I download file with address like this "http://***.com/file.php/ABC.html" automatically ? [message #184067 is a reply to message #184064] Wed, 04 December 2013 03:41 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 12/3/2013 9:26 PM, zhangfj(at)gmail(dot)com wrote:
> 在 2013年12月3日星期二UTC+8下午6时09分34秒,The Natural Philosopher写道:
>> On 03/12/13 03:10, zhangfj(at)gmail(dot)com wrote:
>>
>>> Thank you for your informative reply.
>>
>>>
>>
>>> Briefly, my problem is that I can't download the file by programming.
>>
>>> I want to change "ABC" in the URL to download files automatically from one site.
>>
>>>
>>
>>
>>
>> You need to have a link top a PHP program that reads the file, then sets
>>
>> up headers top tell the browser that it is not (to be understood to be)
>>
>> an HTML: page, but a file download, and then sends the file.
>>
>>
>>
>> so if your program was say -getfile.php and the file was 'rubbish.html'
>>
>>
>>
>> <?php
>>
>> header("Content-Disposition: attachment; filename=\"rubbish.html\"");
>>
>> header("Content-Type: text/plain");
>>
>> $data=file_get_contents("rubbish.html");
>>
>> echo($data);
>>
>>
>>
>> and that's it. No closing ?> should be used so there is no danger of
>>
>> setting characters NOT in the file itself - the script exits still in
>>
>> 'php mode'
>>
>>
>>
>> in your main page use
>>
>>
>>
>> <a href="getfile.php">Download the file here</a>
>>
>>
>>
>> Setting the content-disposition to 'attachment' strongly suggests to the
>>
>> browser that the contents should not be displayed as HTML but should be
>>
>> downloaded instead. However this behaviour is never 100% guaranteed.
>>
>>
>>
>> instead of a local filename you can use a URL as well, if you are trying
>>
>> to 'scrape' another website.
>>
>>
>>
>> curl() will give you more control if you need it than
>>
>> file_get_contents() for that.
>>
>>
>>
>> http://us1.php.net/manual/en/curl.examples-basic.php
>>
>>
>>
>>
>>
>> --
>>
>> Ineptocracy
>>
>>
>>
>> (in-ep-toc’-ra-cy) – a system of government where the least capable to
>>
>> lead are elected by the least capable of producing, and where the
>>
>> members of society least likely to sustain themselves or succeed, are
>>
>> rewarded with goods and services paid for by the confiscated wealth of a
>>
>> diminishing number of producers.
>
> Thanks for your information in detail, I can't understand them now. I will pay attention to that website to follow your idea.
>

Don't waste your time. TNP didn't even understand your question, and
his response is way off target. But that's pretty normal for him.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: foreach as list
Next Topic: illegal offset problem
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Dec 26 23:48:17 GMT 2024

Total time taken to generate the page: 0.02560 seconds