PHP / Laravel
Plain cURL anywhere, or a one-liner in Laravel.
Developers⏱ 2 min
Plain cURL works anywhere. In Laravel, the HTTP client is a one-liner.
Laravel
Http::withHeaders([
'X-Api-Key' => config('services.mailflows.key'),
])->post('https://app.postlys.com/api/v1/contacts', [
'email' => $user->email,
'name' => $user->name,
'list' => 'Customers',
]);
Plain PHP (cURL)
$ch = curl_init('https://app.postlys.com/api/v1/contacts');
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ['X-Api-Key: pl_live_xxx'],
CURLOPT_POSTFIELDS => http_build_query([
'email' => $email, 'name' => $name, 'list' => 'Customers',
]),
CURLOPT_RETURNTRANSFER => true,
]);
curl_exec($ch);
Ready to try it? Spin up a workspace and grab your key.