$value) { $fields_string .= $key . '=' . $value . '&'; } rtrim($fields_string, '&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch, CURLOPT_URL, $target_url); curl_setopt($ch, CURLOPT_POST, count($in)); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //execute post $result = curl_exec($ch); //close connection curl_close($ch); // Parse result foreach (explode("\n", $result) as $line) { if ($line == "" || strpos($line, "=") === false) continue; $key = trim(strtok($line, "=")); if ($key != "") { $out[$key] = base64_decode(substr($line, 1 + strlen($key))); } } }