Due to the nature of the HTTP protocol, and the way curl_setopt function works, $anarray cannot be passed directly as an array.
The following statement:
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
takes an array of POST parameters and for each of them there must be a string name and a STRING value. You are passing an array value instead, so the PHP processor is forced to convert it to a string using some lame built-in algorithm, which incurs issuance of the before-mentioned notice ("Array to string conversion in...").
So, in order to properly pass that array ($anarray) to the other side, you have to take care of its encoding (into a string) yourself, as well as the other side has to take care of its decoding (from a string).
My approach in such situations is JSON. It is suitable enough in almost all cases. All you have to do is apply the following technique:
$data=array(
'anarray'=>json_encode($anarray),
'var1'=>$var1,
'var2'=>$var2
);
And then, on the other side of the connection you would retrieve the original array the following way:
$anarray=json_decode($_POST['anarray'],true); // true indicates for associative array rather than an object