Mailee Client v2

GRATIS
Door mailee | Bijgewerkt 3 месяца назад | Data
Populariteit

2.3 / 10

Latency

542ms

Serviceniveau

100%

Health Check

N/A

Terug naar alle discussies

Erro 500 na API

Rapid account: Lucascolette
lucascolette
6 лет назад

Há algum tempo a API do Mailee só retorna erro 500, sendo que as credenciais e api keys estão todas corretas.

Rapid account: Hericson Ramos
HericsonRamos Commented 6 лет назад

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);

Doe mee aan de discussie - voeg hieronder een opmerking toe

Log in / Schrij u in om nieuwe opmerkingen te plaatsen