I have been trying to figure out why I am getting a cURL 400 status and how to fix it in WordPress. Basically, when a user completes a form on the WordPress page and clicks submit, a bunch of functions get triggered. I just added the function below. I tested the API in Postman and it works fine, but it doesn't want to work from this WordPress site. Using the PHP Inserter from the WordPress dashboard, I have inserted the following code that makes an API call: function test(){ $url = "https://api.ongage.net/MY_LIST_ID/api/transactional/send"; $xun = "X_USERNAME: " . MY_USERNAME; $xpw = "X_PASSWORD: " . MY_PASSWORD; $xac = "X_ACCOUNT_CODE: " . MY_ACCOUNTCODE; $content = '{ "list_id": , "campaign_id": , "recipients": ["myEmail@email.com"], "check_status": true, "sending_connection_id": MY_SENDING_CONNECTION_ID }'; $curl = curl_init( $url ); curl_setopt( $curl, CURLOPT_HEADER, false ); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $curl, CURLOPT_HTTPHEADER, array( "Content-type: application/json", $xun, $xpw, $xac ) ); curl_setopt( $curl, CURLOPT_POST, true ); curl_setopt( $curl, CURLOPT_POSTFIELDS, $content ); $json_response = curl_exec( $curl ); $status = curl_getinfo( $curl, CURLINFO_HTTP_CODE ); if ( $status != 200 && $status != 201 ) { $error = error_log( "Error: call to URL $url failed with status $status, response $json_response, curl_error " . curl_error( $curl ) . ", curl_errno " . curl_errno( $curl ) ); echo '<script language="javascript">'; echo 'alert("fail "+'.$status.')'; echo '</script>'; } else { echo '<script language="javascript">'; echo 'alert("success")'; echo '</script>'; } curl_close( $curl ); $response = json_decode( $json_response, true ); } In the IF statement above, the alert window shows a 400. I have no idea why, and I am not sure how to to check it. Please help.