NYCPHP Meetup

NYPHP.org

[nycphp-talk] How to pass on variables with POST without using a form

David Krings ramons at gmx.net
Wed Sep 20 19:46:56 EDT 2006


Hi,

indeed cURL it is, but that wasn't what I recall using. I also found the 
deal with sockets, but that looks awfully scary.

Now, cURL triggers another question. Can I send multiple

         curl_setopt($ch, CURLOPT_POSTFIELDS, "$curlpost");

with $curlpost something like data1=value1, or do I need to jam that all 
into one string and tie it together with the &? If yes, then I need to add 
more code to screen for & on all variables as it is very likely that the & 
may be included. I also saw on php.net this:
         "Just a reminder: When setting your CURLOPT_POSTFIELDS remember to 
replace the spaces in your values with %20 "

Ah, bummer! It basically expects the name=data sets to be formatted as if 
one wants to send a get via URL.

I guess I go against my own advice, pack the two dozen variables into the 
session and then unset them after savely retrieving them........unless 
someone has a better idea that is not as painful as manipulating headers or 
massaging strings for cURL to use.

Bah! This rapidly inhales! :(

                 Thanks for the tip anyway, I can see some other good uses 
for cURL.


                         David K.


At 06:41 PM 9/20/2006, you wrote:
>cURL lib, no? Peter
>
>-----Original Message-----
>From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
>Behalf Of David Krings
>Sent: Wednesday, September 20, 2006 6:17 PM
>To: talk at lists.nyphp.org
>Subject: [nycphp-talk] How to pass on variables with POST without using a
>form
>
>
>Hi,
>
>how can I pass a value via POST without using an HTML form? Some time ago I
>came across the same problem and I think I found a simple solution, but I
>can neither find my cognitions nor the code nor the source I got the
>information from. Maybe I am just dreaming, but I guess if there is a way
>then you know about it.
>
>Thanks in advance,
>
>
>David K.




More information about the talk mailing list