Hi all,
I'm trying to send some data to a remote domain but am having an issue with one of the variables being an array. The problem is that the preferences array loses it's individual values at the other end. Any idea what I'm doing wrong here?
$url = 'http://foo.com/';
$params = array(
'name' => ' Test',
'age' => 24,
'preferences' => array(1,2,3,4,5,6)
)
$user_agent = "Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
if(curl_exec($ch) === false) {
echo 0;
} else {
echo 1;
}
curl_close ($ch);