Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!news.internetdienste.de!news.tu-darmstadt.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php Subject: Re: Simulating a Form Method=Post submission in PHP Date: Sun, 17 Jun 2012 14:19:59 +0200 Lines: 57 Message-ID: References: <6s0va9-ugd.ln1@luuk.invalid.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net hobxz3y4Xt1OYMjflwzOXghLX5QlVPFnJek+CzsNEoX7dlg06iIUHiCCQzMY+By/59 Cancel-Lock: sha1:rfSa2qrdQWk4P+I/xEzMFAxPFQk= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120613 Firefox/12.0 SeaMonkey/2.9.1 In-Reply-To: Xref: csiph.com comp.lang.php:6352 Robert Rosenberg wrote: > On 06/16/2012 14:46, in article 6s0va9-ugd.ln1@luuk.invalid.lan, "Luuk" >> use curl (example #2) >> see: http://www.php.net/manual/en/function.curl-setopt.php > Example 2 was EXACTLY what I needed (even though all I wanted to do was pass > a set of parms not load a file). > > One other query. I seem to remember a site whose function was to display all > the headers being passed. I think it was a security type page whose purposed > was to show all the data being leaked/sent in the headers when you connect. > I would like to see what I ended up sending (as well as all the headers > being sent) so I have a reference to see what the cURL function caused the > browser to send. Cam you refresh my memory by supplying a URL for that site. First of all, when you are using PHP on a website, everything regarding PHP is executed on the web server, so the users web browser will not do anything more than send a form to your script. If you want to have header information which curl sent to the server, you can do the following before you use curl_close(): $sentheader = curl_getinfo($ch, CURLINFO_HEADER_OUT); If you want to have the header you got from the remote server, then do the following before curl_exec(): curl_setopt($ch, CURLINFO_HEADER_OUT, 1); and before curl_close(): $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $header = substr($response, 0, $header_size); If you are interested of seeing the header that the user sent when they posted the the form: $headers = apache_request_headers(); foreach ($headers as $header => $value) { echo "$header: $value
\n"; } This will only work on a apache server, depending on how you have setup the apache server to execute php. There is suggestion on a work around which you can read at: http://www.rvaidya.com/blog/php/2009/02/25/get-request-headers-sent-by-client-in-php/ -- //Aho