For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > October 2004 > Re: http request using fsockopen









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: http request using fsockopen
Manuel Lemos

2004-10-25, 3:56 pm

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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com