cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: handing out browser control

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 11 Jun 2001 11:36:58 +0200 (MET DST)

On Sat, 9 Jun 2001, Juan Valentín-Pastrana wrote:

> i have server A which must post something to secure server B, and that
> server B output will take over browser control. i am pursuing SAME EFFECT
> as if i clicked SUBMIT in this form:

 [snip]

> i need this call to be made automatically -without user clicking- so i
> use curl to post the data to the sever using https and wait for its
> output. the output of that call is a new web page with its own links. so
> i get links & images with its relative path, ie:
>
> <IMG SRC="server_B/relative/path/image.gif">, which is broken !

Yes of course. You need to translate all links in the HTML to point to the
proper _absolute_ server_B-page. If that is at all possible with that simple
means (you might need to pass-thru/translate things like cookies too, which
easily could become a mess).

Possibly, you translate all links in the page to go through a proxy-script on
server A that automatically gets the correct page from server B and displays
it to the client.

> the URL in the browser is still the calling one. i call curl from php in
> this way:
>
> $out=`(curl -d ... https... -L)`;
> $output=parse($out);
> echo $output;
>
> parsing the returned data and prepending missing url can fix some. but
> some times i won't know how to parse in advance !

It could handle all cases, if you just write your translator good enough.

> how to avoid this ?

If you need to do this (getting the page from serverB and showing it on
serverA), I can't see how you can avoid this step.

> is curl the right tool for this purpose ?

Your problem is obviously not the fetching of the page, which curl does and
is a suitable tool for. Your problem is that you need to translate URLs/links
in a HTML page to make them go through a script at your site or to the
absolute pages of the second server.

That is not anything curl can help you with. Curl gets the page for you. You
do the rest.

-- 
     Daniel Stenberg -- curl dude -- http://curl.haxx.se/
_______________________________________________
Curl-and-php mailing list
http://curl.haxx.se/
Received on 2001-06-11