cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Postfields question

From: Dave Withnall <withnall_at_connexus.net.au>
Date: Mon, 03 Mar 2003 15:53:57 +1000

At 11:03 PM 2/03/2003 -0600, Jesse Brede wrote:
>What is the proper way to use the Postfields function from curl in php?
>
>I have read that $POSTFIELDS needs to be an associative array. This has
>not worked for me.
>Such as
>Putting my post variables in one long string seems to be the only way to
>get this function to work correctly.
>such as
>$POSTFIELDS = "login=login_name&password=xxxxx&header=HF#%&=1324WER";

this is the correct way.

>This being said, I have post variables that oddly enough have both & and =
>symbols in them. Is there a php or curl function to make these variables
>function correctly. I think if I could get the associative array working
>everything would be fine. I have tried using single and double quotes.

urlencode the variables being passed.
eg if login = bil&"',
then you want
$POSTFIELDS = "login=" . urlencode("bil&\"',") . "&blah...

if you want the assoc array to work then read up on foreach and convert the
array to a string with the variables urlencoded.

D.

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-03-03