无法在php中使用curl发布数据

I have this script:

$ch = curl_init($url_path.'admin/');
$cookiefile = $srv_path."admin/cookie.txt" ;
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec ($ch);

//
curl_setopt($ch, CURLOPT_PROXY, "http://127.0.0.1.:8888");
curl_setopt($ch, CURLOPT_PROXYPORT, 8888);
curl_setopt($ch, CURLOPT_HEADER, 1);
preg_match('/^Set-Cookie: (.*?);/m', curl_exec($ch), $m);

$xid = substr($m[1], 10);    


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url_path.'admin/login.php');

// ENABLE HTTP POST
curl_setopt($ch, CURLOPT_POST, 1);
//SET POST PARAMETERS : FORM VALUES FOR EACH FIELD 
curl_setopt($ch, CURLOPT_POSTFIELDS, 'xid_7d781='.$xid.'$username=*****&password=******&mode=login&usertype=P&redirect=admin');

# Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL # not to print out the results of its query.
# Instead, it will return the results as a string return value # from curl_exec() instead of the usual true/false.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Allow redirection     
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile); 
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);

// 
//echo('EXECUTE 1st REQUEST (FORM LOGIN)');
$page = curl_exec ($ch);
curl_close ($ch);
echo $page;

but when i call it, the form fields are blank. Furthermore the method that returns is GET and not POST. Why returns GET?

The same code if i try it for another domain run correctly and that is also very strange. Is it possible the post method blocked by something?

I tried to echo any possible errors with var_dump(curl_error($ch)); but the string is empty.