php3-list | 199908
Date: 08/24/99
- Next message: php3 <email protected>: "[PHP3] phpLib and forms"
- Previous message: Philip Diller: "Re: [PHP3] :nospam..."
- In reply to: Peter Sorger: "re: [PHP3] - post & redirect"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Peter Sorger wrote:
>
> Some time ago, Jason Brooke has posted a code to pass variables to another
> page rather by POST method than the GET method
> the code was:
>
> $host="my.host.com";
> $mydata="k=$k";
> $sp=fsockopen($host,80);
> fputs($sp,"POST /index.php3 HTTP/1.1\n");
> fputs($sp,"Host: $host\n");
> fputs($sp,"Content-type: application/x-www-form-urlencoded\n");
> fputs($sp,"Content-length: ".strlen($mydata)."\n");
> fputs($sp,"Connection: close\n\n");
> fputs($sp,$mydata);
> fclose($sp);
>
> The problem is:
> When I post the variables like that, the only thing I do, is open a
> connection from php3 script to the other php3 script without getting any
> output. I tried to
>
> echo fgets($sp,1024)."<BR>";
>
> serveral times, but while the connection was between the two scripts, it did
> not detect my browser either I could not get to any cookies or even the
> "REAL" IP, it returned the IP address of the server, where was the script
> located.
>
> I need something that will let MY browser post the variables to the server.
>
> Anyone gets any idea ?
I can't quite make out exactly what you're trying to do - first you say
you tried to do a post from Php, but couldn't read anything back - then
you say you want YOUR browser to post variables back to the server.
For the first part of your question, have a look at
http://jason.etranz.com.au/post - page1.php3 is the one you want view
first. Use your browser's 'view source' feature for a clearer view on
the returned output.
Also, both files have been copied to a .txt extension so you can easily
see the source.
For the second part of your question, you have to realise that Php has
no control over what happens at the client end - you cannot make Php
cause the browser to submit a form after it's been sent to the client.
You can do it with javascript though, since javascript is interpreted on
the client side by their web browser.
You can use one of the event handlers like onLoad() or onFocus() or
onBlur() etc etc to trigger submit().
jason
-- PHP 3 Mailing List <http://www.php.net/> To unsubscribe, send an empty message to php3-unsubscribe <email protected> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected> To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: php3 <email protected>: "[PHP3] phpLib and forms"
- Previous message: Philip Diller: "Re: [PHP3] :nospam..."
- In reply to: Peter Sorger: "re: [PHP3] - post & redirect"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

