Há algum tempo a API do Mailee só retorna erro 500, sendo que as credenciais e api keys estão todas corretas.
Tenta assim!
// Request Type: GET | POST | PUT | PATCH | DELETE // URL $url = "https://mailee.p.mashape.com/contacts?api_key=*********&subdomain=*********"; // request timeout in seconds $timeout = 10; // Custom headers. X-Mashape-Key is mandatory, you can add more if you want $headers = array( "X-Mashape-Key: F*************************************7Y", "Content-Type: application/x-www-form-urlencoded", "Accept : application/json" ); $fields = array( 'name' => urlencode( $customer_info['firstname']), 'email' => urlencode($customer_info['email']), ); //url-ify the data for the POST foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string, '&'); // Request Type: GET | POST | PUT | PATCH | DELETE $method = 'POST'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers ); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $data = curl_exec($ch); curl_close($ch); $newUser = json_decode($data);
הצטרף לדיון - הוסף תגובה למטה:
Tenta assim!