$val) { $poststring .= $key . "=" . $val . "&"; } // strip off trailing ampersand $poststring = substr($poststring, 0, -1); // init curl connection $CR = curl_init(); curl_setopt($CR, CURLOPT_URL, "https://".$host.$path); curl_setopt($CR, CURLOPT_POST, 1); curl_setopt($CR, CURLOPT_FAILONERROR, true); curl_setopt($CR, CURLOPT_POSTFIELDS, $poststring); curl_setopt($CR, CURLOPT_RETURNTRANSFER, 1); curl_setopt($CR, CURLOPT_SSL_VERIFYPEER, 0); // actual curl execution perfom $result = curl_exec( $CR ); $error = curl_error( $CR ); // on error - exit with error message if( !empty( $error )) { die($error); } curl_close( $CR ); // re-format the string into array $response =explode('&', $result); foreach($response as $key=>$value) { unset($tmparr); $tmparr=explode("=",$value); $answer[$tmparr[0]]=$tmparr[1]; } print "
"; print_r($answer); // response array with string keys