From: "Robert P. J. Day" on

i'm sure this isn't hard to do, but i'm having end-of-week brain
cramps. just now, i installed a PHP package that lets me download
thumbnails of image files stored on a server -- the URL to generate
and download a thumbnail is, say:

http://server/d1/d2/thumbnail.php?fileID=whatever&arg1=val1&arg2=val2

and so on. unsurprisingly, the thumbnail generation program accepts
numerous arguments and is incredibly sophisticated, and is stored in a
subdirectory under /var/www/html and ... well, you get the idea,
calling it directly involves creating quite the URL.

instead, i'd like to stuff a wrapper script at the top of the
document root which hides all that complexity, so i can just browse
to:

http://server/thumb.php?fileID=whatever

and have that top-level thumb.php script make the appropriate
invocation to the real thumbnail.php script with all of those
(default) arguments and values.

so, what would thumb.php look like? i obviously need to simulate a
POST call, retrieve the output and pass it back unchanged. thoughts?
surely this is something that people want to do on a regular basis,
no?

rday
--

========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================
From: Peter Lind on
php.net/curl should be able to do what you want.

file_get_contents with a proper stream context should also work (have
a look at functions like http://dk.php.net/manual/en/context.http.php
)

Regards
Peter

On 23 April 2010 17:18, Robert P. J. Day <rpjday(a)crashcourse.ca> wrote:
>
>  i'm sure this isn't hard to do, but i'm having end-of-week brain
> cramps.  just now, i installed a PHP package that lets me download
> thumbnails of image files stored on a server -- the URL to generate
> and download a thumbnail is, say:
>
> http://server/d1/d2/thumbnail.php?fileID=whatever&arg1=val1&arg2=val2
>
> and so on.  unsurprisingly, the thumbnail generation program accepts
> numerous arguments and is incredibly sophisticated, and is stored in a
> subdirectory under /var/www/html and ... well, you get the idea,
> calling it directly involves creating quite the URL.
>
>  instead, i'd like to stuff a wrapper script at the top of the
> document root which hides all that complexity, so i can just browse
> to:
>
> http://server/thumb.php?fileID=whatever
>
> and have that top-level thumb.php script make the appropriate
> invocation to the real thumbnail.php script with all of those
> (default) arguments and values.
>
>  so, what would thumb.php look like?  i obviously need to simulate a
> POST call, retrieve the output and pass it back unchanged.  thoughts?
> surely this is something that people want to do on a regular basis,
> no?
>
> rday
> --
>
> ========================================================================
> Robert P. J. Day                               Waterloo, Ontario, CANADA
>
>            Linux Consulting, Training and Kernel Pedantry.
>
> Web page:                                          http://crashcourse.ca
> Twitter:                                       http://twitter.com/rpjday
> ========================================================================
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>
From: Nathan Rixham on
Peter Lind wrote:
> php.net/curl should be able to do what you want.

+1

> file_get_contents with a proper stream context should also work (have
> a look at functions like http://dk.php.net/manual/en/context.http.php
> )

very important to note that file_get_contents uses HTTP 1.0 not 1.1 by
default.

99% of web servers use HTTP 1.1 nowadays.

ps: please don't hook up on the 99%, i don't know the exact figure :p
From: Danilo Moncastro Sabbagh on
Even tho most of the servers uses 1.1 they have compliant configurations.


or at least they should.

things like mod_gzip and deflate are usually only used if the request is 1.1

to be honest.. if i understood you correctly the curl solution or even a wrapper for another downloader like wget or aria is possible...
but id guess that a more fast and simple solution could be archived with a javascript chamging the image srcs or an ajax request with jquery or other popular yet simple js lib.


Dan


Danilo Moncastro Sabbagh
cel: +55 31 88613128
gtalk: toreador(a)gmail.com


Em 25/04/2010, às 15:06, Nathan Rixham escreveu:

> Peter Lind wrote:
>> php.net/curl should be able to do what you want.
>
> +1
>
>> file_get_contents with a proper stream context should also work (have
>> a look at functions like http://dk.php.net/manual/en/context.http.php
>> )
>
> very important to note that file_get_contents uses HTTP 1.0 not 1.1 by
> default.
>
> 99% of web servers use HTTP 1.1 nowadays.
>
> ps: please don't hook up on the 99%, i don't know the exact figure :p
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>