cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: handing out browser control

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 7 Jun 2001 20:44:23 +0200 (MET DST)

On Thu, 7 Jun 2001, Juan Valentín-Pastrana wrote:

> i am pursuing same effect as if i clicked SUBMIT in this form:
> <FORM METHOD="https://..." ACTION="programA.exe">
> <INPUT NAME=nom VALUE=val>
> ...
> </FORM>

That would be a severly bad <form> usage. But I take it that's beyond the
point here...

> but as i use PHP to access a DB i need curl to post some data and call
> programA using https. i called curl from php in these ways:

You can't "call programA using https". Using curl, you can send requests to
the server. The server might run whatever program it thinks should run, and
it can base its decisions on the request you pass to it.

Still, we never 'call programs' using curl. We request or send data from or
to a server.

I trust this PHP talk following here is running in the server when you access
the PHP page using a browser/client? (You might go for the curl-and-php
mailing list, as that one is *surprise-surprise* dedicated for curl and PHP
issues.)

> 1- exec(curl -d ... https... -L); no response at all from programA

That would invoke curl to request a file from a https:// server, it doesn't
"call" a program.

> 2- passthru(curl...); data is presented on the screen, but
> no images or links

I have no idea what this does, I'm afraid I'm a PHP cluebie.

> 3- system(curl...); same as above

That would also run the curl command to get a URL.

[etc...]

> programA is supposed take over all browser interaction onwards.

I don't understand how this involves curl.

> what happens however (using 2,3&4) is that all the output from programA
> -HTML data- returned by curl is dumped to the calling page url, so all
> links and images are broken.

Yes, because curl fetches the URL and PHP displays it for the browser.

> how to avoid this ?

If the program you want to "take over all browser interaction" is on a remote
server, then I can only suggest this approach:

 - the php script you have is 'main.php'
 - main.php use curl to fetch the page from SERVER://PAGE
 - you translate all the links to use the local php-script 'prox', like
  'prox.php?real_url'
 - you write 'prox.php' to use curl to get the URL given as argument and
   present the data to the browser.

 so, given that the page at SERVER://PAGE only contains a single image like:
<img src="moo.jpg">

 when the browser gets 'main.php', you get the SERVER://PAGE page and
translates all links, so the output becomes:

<img src="prox.php?SERVER://PAGE/moo.jpg">

 ... so the browser will then ask your 'prox.php' script for all other
resources found on the "SERVER://PAGE" and so on.

But in general, this has very little to do with curl...

-- 
     Daniel Stenberg -- curl dude -- http://curl.haxx.se/
Received on 2001-06-07