How can one implement GET from within Apache. Basically the goal is to
do an Internal GET and store some information form another Server. The
server chosen is based on the users request. The information is
processed (after receiving) and presented to USER.
Regards
Raj
You need to use some sort of Apache-addon for this. You could use a straight
Perl CGI and the LWP module, or mod_perl, or PHP.
See http://perl.apache.org
and http://www.php.net
-Rasmus
In Apache 1.3.6 I did not see any module names mod_perl. ( There is no
modules/standard/mod_perl). But there is a mod_cgi and is already enabled.
The task at hand is to read headers (e.g request-header
New:="http://a.b.c.d/File") and issue ( GET http://a.b.c.d/File LocalSaveFileName
). Also I do not want to use PHP as this is not something that is embeded into
the HTML but at header generation level.
Any code snippet... on usage of cgi( need to call cgi from the server code
http_protocol.c )
Regards
Raj
That's why I provided you with the URL: http://perl.apache.org
>The task at hand is to read headers (e.g request-header
>New:="http://a.b.c.d/File") and issue ( GET http://a.b.c.d/File LocalSaveFileName
>). Also I do not want to use PHP as this is not something that is embeded into
>the HTML but at header generation level.
PHP is perfectly appropriate for this. There are all sorts of ways to
automatically trigger PHP to do something. For example, on a request
for http://a.b.c.d/File assuming this file does not exist, you could
set things up so a PHP script is your ErrorDocument and this PHP script
could then do a GET request to some other server, fetch the file, save it
as /File and even return it. And then the next time a request for
http://a.b.c.d/File comes along it will get served up statically.
I realize this isn't exactly what you are looking for, but it illustrates
a way to invisibly invoke PHP to do something. In your case you might need
a little mod_rewrite rule to redirect all requests to a specific PHP script.
>Any code snippet... on usage of cgi( need to call cgi from the server code
>http_protocol.c )
Basically, if you are even remotely considering doing this with cgi, then
both PHP and mod_perl are much more appropriate and will be an order of
magnitude faster than a cgi-based solution.
-Rasmus
mod_perl is not part of the standard Apache distribution. You can find
it at http://perl.apache.org/.
> The task at hand is to read headers (e.g request-header
> New:="http://a.b.c.d/File") and issue ( GET http://a.b.c.d/File LocalSaveFileName
> ). Also I do not want to use PHP as this is not something that is embeded into
> the HTML but at header generation level.
If you want simply want to forward the request to another server, you
can use ProxyPass or mod_rewrite.
If you want to do something different (such as GET a URL from another
server and then somehow munge that data into your own data), then you'll
need to write something to handle that. The details of writing a CGI
would depend on the language you're using.
To get Apache to invoke your CGI, you have a couple of options. If you
don't want to create the file on your server, you can use
ErrorDocument. If the file does exist, you can use Action to cause the
request of the file to invoke your CGI.
moo
----------------------------------------------------------------------
Ron Klatchko - Manager, Advanced Technology Group
UCSF Library and Center for Knowledge Management
r...@library.ucsf.edu
Raj
P.S: Do you have any prior PHP experience??
Rasmus Lerdorf wrote:
> >In Apache 1.3.6 I did not see any module names mod_perl. ( There is no
> >modules/standard/mod_perl). But there is a mod_cgi and is already enabled.
>
> That's why I provided you with the URL: http://perl.apache.org
>
> >The task at hand is to read headers (e.g request-header
> >New:="http://a.b.c.d/File") and issue ( GET http://a.b.c.d/File LocalSaveFileName
> >). Also I do not want to use PHP as this is not something that is embeded into
> >the HTML but at header generation level.
>
A bit, yes.
-Rasmus
moch...@tri.sbc.com wrote:
> Hi
>
> How can one implement GET from within Apache. Basically the goal is to
> do an Internal GET and store some information form another Server. The
> server chosen is based on the users request. The information is
> processed (after receiving) and presented to USER.
>
> Regards
> Raj
>
>
--
Dave Warner
Lucent Technologies, Inc.
+1-303-538-1748
Stupid question. I need to incorporate the PHP functions/calls into the
http_protocol.c code in src/main(Apache). How do I do that.
Basically PHP into C code. Do I need to include any header files etc...
Raj
Code snippts....
No, you really don't need to mess with http_protocol.c at all. PHP
gets linked into Apache as a module. You just need to figure out
how to properly trigger your PHP script. I think you need to do a bit
of reading.
-Rasmus
I am intrested in invoking a GET from withing the Apache Server C code.
"exec("GET http://.../RemoteFileName LocalFileName");
Any help appreciated.
Regards
Raj
>Hi Dave
>
>I am intrested in invoking a GET from withing the Apache Server C code.
>"exec("GET http://.../RemoteFileName LocalFileName");
Why? This sort of thing is what modules were invented for.
--
Reinier