Re: http request using fsockopen

From: Manuel Lemos (mlemos_at_acm.org)
Date: 10/25/04


Date: Mon, 25 Oct 2004 16:44:41 -0300

Hello,

On 10/25/2004 09:46 AM, Rob wrote:
>
> I have a form on page A which is submitted trough a POST method to page B.
> On the start of page B I check var $foo. If true I want to "forward" the
> request to
> page C. Sending the POST data also though the POST method.
>
> I manually create a HTTP request to page C and use the fsockopen method to
> sent the request.
>
> As a result I get the requested page C (status code "200 OK" is returned)
> but the
> POST data is not received/parsed(?). I mean the $_POST array is empty in
> page C. All other PHP scripts in page C is executed as expected though.
>
> My questions:
> 1 Is what I am doing possible in the first place?

Sure.

> 2 If so, what is the correct syntax to sent the
> POST data ($query) in the entity body of the request?

It is hard to tell but you may not be sending the request data correctly.

You may want to try this HTTP client class that you can be sure that it
can compose and send your POST requests properly.

http://www.phpclasses.org/httpclient

-- 
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html


Relevant Pages

  • Re: Securing an Email script
    ... request to our sales office. ... Since you do ZERO checking on the values it's nothing BUT security ... very powerful PHP function to validate form fields and other ...
    (comp.lang.php)
  • Re: Object Oriented Content System - the idea
    ... >I expected php to be smarter then that. ... >form like bytecode in memory for the next request. ... each action added some stuff to a "response" XML document. ... that map/object/data and formats it for HTML display using an includeed PHP ...
    (comp.lang.php)
  • Re: Securing an Email script
    ... request to our sales office. ... Since you do ZERO checking on the values it's nothing BUT security issues. ... very powerful PHP function to validate form fields and other strings - ...
    (comp.lang.php)
  • http request using fsockopen
    ... On the start of page B I check var $foo. ... Sending the POST data also though the POST method. ... I manually create a HTTP request to page C and use the fsockopen method to ...
    (php.general)
  • http request using fsockopen
    ... On the start of page B I check var $foo. ... Sending the POST data also though the POST method. ... I manually create a HTTP request to page C and use the fsockopen method to ...
    (alt.php)