Re: [PHP] preprocessing

2001-05-17 Thread David VanHorn

At 10:18 AM 5/17/01 -0700, [EMAIL PROTECTED] wrote:

I have what I feel to be a strange problem (I'm most likely wrong here).
I have page A, which is an internal page, which posts to page C which is 
external (belongs to another company). What I would like is to insert a 
preprocessing script (let's call it page b). So, the end result would be, 
users input data to page a, page a then posts to page b, page b processes 
all variables etc and then posts to page c. I don't want the customer, to 
ever really have to interact with page b. Is that possible?
If there is a command to do this, which I must've missed, that would 
really be all I need ;)

You can have tons of processing going on in a php script, but it sounds 
like what you need is to do the processing at the top of page C, then once 
that's done, generate output to the user as page C is doing now.   Just put 
the processing code on top of the page, and you should be ok.
Might need a while statement to check if it's done before proceeding.

--
Dave's Engineering Page: http://www.dvanhorn.org
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] preprocessing

2001-05-17 Thread Nathan Cook

Try going to the page with the vars you need in the URL.  i.e.:
http://www.www.com/cgi-bin/script?var1=testvar2=testing

If that works then just use a simple header location forward in script 'b':
// process vars
header(LOCATION:http://www.www.com/cgi-bin/script?var1=testvar2=testing;);

That way the user will never have to interact with page 'b'.  Note: do not start
any output before the header command.

If that doesn't work then there should be some other way of assembling cgi-post
headers with the header() function.

Good Luck.
Nathan Cook
[EMAIL PROTECTED]
- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 17, 2001 11:18 AM
Subject: [PHP] preprocessing



 I have what I feel to be a strange problem (I'm most likely wrong here).
 I have page A, which is an internal page, which posts to page C which is
external (belongs to another company). What I would like is to insert a
preprocessing script (let's call it page b). So, the end result would be, users
input data to page a, page a then posts to page b, page b processes all
variables etc and then posts to page c. I don't want the customer, to ever
really have to interact with page b. Is that possible?
 If there is a command to do this, which I must've missed, that would really be
all I need ;)

 Louis G

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: Re: [PHP] preprocessing

2001-05-17 Thread pkshifted


Unfortunately, I don't control page c, or else this would be a mute point. That's why 
I need page B. Good idea though.

At 10:18 AM 5/17/01 -0700, [EMAIL PROTECTED] wrote:
I have what I feel to be a strange problem (I'm most likely wrong here).
I have page A, which is an internal page, which posts to page C which is 
external (belongs to another company). What I would like is to insert a 
preprocessing script (let's call it page b). So, the end result would be, 
users input data to page a, page a then posts to page b, page b processes 
all variables etc and then posts to page c. I don't want the customer, to 
ever really have to interact with page b. Is that possible?
If there is a command to do this, which I must've missed, that would 
really be all I need ;)
You can have tons of processing going on in a php script, but it sounds 
like what you need is to do the processing at the top of page C, then once 
that's done, generate output to the user as page C is doing now.   Just put 
the processing code on top of the page, and you should be ok.
Might need a while statement to check if it's done before proceeding.
--
Dave's Engineering Page: http://www.dvanhorn.org
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: Re: [PHP] preprocessing

2001-05-17 Thread pkshifted


This is a fairly solid suggestion, and it may be what I have to do. But, 
unfortunately, Page C is expecting a POST, not a GET, which may make it not work. 
Also, I would like to avoid this if possible due to some of the sensitive information 
that will be being passed to and fro. Even if it will be done using SSL.

Try going to the page with the vars you need in the URL.  i.e.:
http://www.www.com/cgi-bin/script?var1=testvar2=testing
If that works then just use a simple header location forward in script 'b':
// process vars
header(LOCATION:http://www.www.com/cgi-bin/script?var1=testvar2=testing;);
That way the user will never have to interact with page 'b'.  Note: do not start
any output before the header command.
If that doesn't work then there should be some other way of assembling cgi-post
headers with the header() function.
Good Luck.
Nathan Cook
[EMAIL PROTECTED]
- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 17, 2001 11:18 AM
Subject: [PHP] preprocessing

 I have what I feel to be a strange problem (I'm most likely wrong here).
 I have page A, which is an internal page, which posts to page C which is
external (belongs to another company). What I would like is to insert a
preprocessing script (let's call it page b). So, the end result would be, users
input data to page a, page a then posts to page b, page b processes all
variables etc and then posts to page c. I don't want the customer, to ever
really have to interact with page b. Is that possible?
 If there is a command to do this, which I must've missed, that would really be
all I need ;)

 Louis G

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: Re: [PHP] preprocessing

2001-05-17 Thread David VanHorn

At 10:48 AM 5/17/01 -0700, [EMAIL PROTECTED] wrote:

Unfortunately, I don't control page c, or else this would be a mute point. 
That's why I need page B. Good idea though.

Well, it sounds like an auto-redirect is about your only choice.

--
Dave's Engineering Page: http://www.dvanhorn.org
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: Re: [PHP] preprocessing

2001-05-17 Thread Nathan Cook

In that case you may be able to assemble the headers of a get using the header()
function.  I will look up a few more things for you and get back to you after
lunch! :)

Nathan Cook
[EMAIL PROTECTED]

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, May 17, 2001 11:51 AM
Subject: RE: Re: [PHP] preprocessing



 This is a fairly solid suggestion, and it may be what I have to do. But,
unfortunately, Page C is expecting a POST, not a GET, which may make it not
work. Also, I would like to avoid this if possible due to some of the sensitive
information that will be being passed to and fro. Even if it will be done using
SSL.

 Try going to the page with the vars you need in the URL.  i.e.:
 http://www.www.com/cgi-bin/script?var1=testvar2=testing
 If that works then just use a simple header location forward in script 'b':
 // process vars
 header(LOCATION:http://www.www.com/cgi-bin/script?var1=testvar2=testing;);
 That way the user will never have to interact with page 'b'.  Note: do not
start
 any output before the header command.
 If that doesn't work then there should be some other way of assembling
cgi-post
 headers with the header() function.
 Good Luck.
 Nathan Cook
 [EMAIL PROTECTED]
 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, May 17, 2001 11:18 AM
 Subject: [PHP] preprocessing
 
  I have what I feel to be a strange problem (I'm most likely wrong here).
  I have page A, which is an internal page, which posts to page C which is
 external (belongs to another company). What I would like is to insert a
 preprocessing script (let's call it page b). So, the end result would be,
users
 input data to page a, page a then posts to page b, page b processes all
 variables etc and then posts to page c. I don't want the customer, to ever
 really have to interact with page b. Is that possible?
  If there is a command to do this, which I must've missed, that would really
be
 all I need ;)
 
  Louis G
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: Re: [PHP] preprocessing

2001-05-17 Thread Johnson, Kirk

I don't know of any way to make a script self-submitting for POST data,
wish I did. Alternatives: 

1. Do the processing with JavaScript on the original input page.
2. Get the other company to modify C to look for GET variables, and build a
query string as suggested earlier.
3. Add a simple FORM to B with just a Submit button, with a message Please
click the Submit button to continue.

Kirk

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 17, 2001 11:51 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: RE: Re: [PHP] preprocessing
 
 

 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, May 17, 2001 11:18 AM
 Subject: [PHP] preprocessing
 
  I have what I feel to be a strange problem (I'm most 
 likely wrong here).
  I have page A, which is an internal page, which posts to 
 page C which is
 external (belongs to another company). What I would like is 
 to insert a
 preprocessing script (let's call it page b). So, the end 
 result would be, users
 input data to page a, page a then posts to page b, page b 
 processes all
 variables etc and then posts to page c. I don't want the 
 customer, to ever
 really have to interact with page b. Is that possible?
  If there is a command to do this, which I must've missed, 
 that would really be
 all I need ;)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] preprocessing

2001-05-17 Thread infoz

There's a public domain function kicking around called post_to_host or
something like that which will do exactly what you wish.  If you search the
list archives I'm sure there will be several pointers to where you can find
it.

- Tim


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] preprocessing

2001-05-17 Thread Johnson, Kirk

Louis, if you track this down, please post back to the list what you find.

TIA

Kirk

 -Original Message-
 From: infoz [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 17, 2001 12:21 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP] preprocessing
 
 
 There's a public domain function kicking around called 
 post_to_host or
 something like that which will do exactly what you wish.  If 
 you search the
 list archives I'm sure there will be several pointers to 
 where you can find
 it.
 
 - Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] preprocessing

2001-05-17 Thread Johnson, Kirk

Thanks, Tim!

http://marc.theaimsgroup.com/?l=php-generalm=98582357009336w=2

Kirk

 -Original Message-
 From: infoz [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 17, 2001 12:21 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP] preprocessing
 
 
 There's a public domain function kicking around called 
 post_to_host or
 something like that which will do exactly what you wish.  If 
 you search the
 list archives I'm sure there will be several pointers to 
 where you can find
 it.
 
 - Tim
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] preprocessing

2001-05-17 Thread infoz

You'll actually want to do a little more than that, i.e. read the socket and
dump it to the browser so that the output from the page you're posting to
gets displayed.   There is another version of that function around that
handles that too.  I can post it later today if nobody else finds it first.
:)

- Tim

- Original Message -
From: Johnson, Kirk [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, May 17, 2001 2:31 PM
Subject: RE: [PHP] preprocessing


 Thanks, Tim!

 http://marc.theaimsgroup.com/?l=php-generalm=98582357009336w=2

 Kirk



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: Re: [PHP] preprocessing

2001-05-17 Thread Nathan Cook

This looks like it will do it.  I haven't tested it, so don't take my word for
it.

?php
/
 *
 * PostIt - Pretend to be a form.
 *
 * Copyright (c) 1999 Holotech Enterprises. All rights reserved.
 * You may freely modify and use this function for your own purposes. You
 * may freely distribute it, without modification and with this notice
 * and entire header intact.
 *
 * This function takes an associative array and a URL. The array is URL-
 * encoded and then POSTed to the URL. If the request succeeds, the
 * response, if any, is returned in a scalar array. Outputting this is the
 * caller's responsibility; bear in mind that it will include the HTTP
 * headers. If the request fails, an associative array is returned with the
 * elements 'errno' and 'errstr' corresponding to the error number and
 * error message. If you have any questions or comments, please direct
 * them to [EMAIL PROTECTED]
 *
 *  Alan Little
 *  Holotech Enterprises
 *  http://www.holotech.net/
 *  December 1999
 *
 /

  function PostIt($DataStream, $URL) {

//  Strip http:// from the URL if present
$URL = ereg_replace(^http://;, , $URL);

//  Separate into Host and URI
$Host = substr($URL, 0, strpos($URL, /));
$URI = strstr($URL, /);

//  Form up the request body
$ReqBody = ;
while (list($key, $val) = each($DataStream)) {
  if ($ReqBody) $ReqBody.= ;
  $ReqBody.= $key.=.urlencode($val);
}
$ContentLength = strlen($ReqBody);

//  Generate the request header
$ReqHeader =
  POST $URI HTTP/1.1\n.
  Host: $Host\n.
  User-Agent: PostIt\n.
  Content-Type: application/x-www-form-urlencoded\n.
  Content-Length: $ContentLength\n\n.
  $ReqBody\n;

//  Open the connection to the host
$socket = fsockopen($Host, 80, $errno, $errstr);
if (!$socket) {
  $Result[errno] = $errno;
  $Result[errstr] = $errstr;
  return $Result;
}
$idx = 0;
fputs($socket, $ReqHeader);
while (!feof($socket)) {
  $Result[$idx++] = fgets($socket, 128);
}
return $Result;
  }
?

Nathan Cook
[EMAIL PROTECTED]
- Original Message -
From: Nathan Cook [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; Php List [EMAIL PROTECTED]
Sent: Thursday, May 17, 2001 11:54 AM
Subject: Re: Re: [PHP] preprocessing


 In that case you may be able to assemble the headers of a get using the
header()
 function.  I will look up a few more things for you and get back to you after
 lunch! :)

 Nathan Cook
 [EMAIL PROTECTED]

 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Thursday, May 17, 2001 11:51 AM
 Subject: RE: Re: [PHP] preprocessing


 
  This is a fairly solid suggestion, and it may be what I have to do. But,
 unfortunately, Page C is expecting a POST, not a GET, which may make it not
 work. Also, I would like to avoid this if possible due to some of the
sensitive
 information that will be being passed to and fro. Even if it will be done
using
 SSL.
 
  Try going to the page with the vars you need in the URL.  i.e.:
  http://www.www.com/cgi-bin/script?var1=testvar2=testing
  If that works then just use a simple header location forward in script 'b':
  // process vars
 
header(LOCATION:http://www.www.com/cgi-bin/script?var1=testvar2=testing;);
  That way the user will never have to interact with page 'b'.  Note: do not
 start
  any output before the header command.
  If that doesn't work then there should be some other way of assembling
 cgi-post
  headers with the header() function.
  Good Luck.
  Nathan Cook
  [EMAIL PROTECTED]
  - Original Message -
  From: [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Thursday, May 17, 2001 11:18 AM
  Subject: [PHP] preprocessing
  
   I have what I feel to be a strange problem (I'm most likely wrong here).
   I have page A, which is an internal page, which posts to page C which is
  external (belongs to another company). What I would like is to insert a
  preprocessing script (let's call it page b). So, the end result would be,
 users
  input data to page a, page a then posts to page b, page b processes all
  variables etc and then posts to page c. I don't want the customer, to ever
  really have to interact with page b. Is that possible?
   If there is a command to do this, which I must've missed, that would
really
 be
  all I need ;)
  
   Louis G
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail: [EMAIL PROTECTED]
  
  
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED

Re: [PHP] preprocessing

2001-05-17 Thread Tolga \thorr\ Orhon

Well, one solution may be (although might not easy) to make your page A to
submit to page B which process information and submits to page C via PHP -
Curl functions. You may POST variables and even use SSL connection. It
worked just fine for me. It is more reliable any javascript solution and
restricts users accessing page B.

thorr

[EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 I have what I feel to be a strange problem (I'm most likely wrong here).
 I have page A, which is an internal page, which posts to page C which is
external (belongs to another company). What I would like is to insert a
preprocessing script (let's call it page b). So, the end result would be,
users input data to page a, page a then posts to page b, page b processes
all variables etc and then posts to page c. I don't want the customer, to
ever really have to interact with page b. Is that possible?
 If there is a command to do this, which I must've missed, that would
really be all I need ;)

 Louis G

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]