Re: how to read posted data?
| From: | Thomas Buck | Date: | Thu, 11 Oct 2001 11:58:37 +0000 |
| Subject: | Re: how to read posted data? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70780@lists.php.net to get a copy of this message | ||
You're using the line "curl_setopt($ch, CURLOPT_POSTFIELDS, "this is posted data");" incorrectly.
To post a few variables, the option needs to take the form
"variable=value&anotherVariable=anotherValue"
e.g.
curl_setopt($ch, CURLOPT_POSTFIELDS, "variable=value&anotherVariable=anotherValue");
Thomas.
<? $ch=curl_init("http://localhost/learning/php/test/curl/receive_post_data.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "this is posted data"); curl_exec($ch); curl_close($ch); ?> On Thu, 11 Oct 2001 12:49:17 +0100, tom@localeyes-uk.com (Thomas Buck) wrote: Yes, I'm not disputing that... all I'm asking is why you can't use $HTTP_POST_VARS ? If you post data to a PHP script using whatever post method you prefer, the variables should be in $HTTP_POST_VARS. Double check the $HTTP_POST_VARS... something like foreach($HTTP_POST_VARS as $key => $value) {echo "$key : $value<br>";} should do the trick. Thomas.-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.netexample: you post an xml string to server php file, but not use form. On Thu, 11 Oct 2001 12:41:13 +0100, tom@localeyes-uk.com (Thomas Buck) wrote:If it's posted data, why can't you access it from $HTTP_POST_VARS ? i.e. you've posted a variable called "name", you can access it from $HTTP_POST_VARS["name"] Thomas. At 11:34 11/10/01 +0000, ZhiQiang He wrote:Use $FieldName or $HTTP_POST_VARS. Niklas -----Original Message----- From: ZhiQiang He [mailto:hhzqq@21cn.com] Sent: 11. lokakuuta 2001 12:54 To: php-general@lists.php.net Subject: [PHP] how to read posted data? we want to use post data in php, how can we read it? note, this post data is not sent by form. thanks in advance, ^_^ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.netyou misunderstanded, i mean this post data is not sent by form. On Thu, 11 Oct 2001 12:58:09 +0300, niklas.lists@publico.fi (=?Iso-8859-1?Q?Niklas_lamp=E9n?=) wrote:-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net