przykłady API

Żądanie POST z
metodą CURL-less w PHP

<?php $url = 'https://rsXXX-api.realsender.com/mail/send'; $data = array('apiuser' =>'ten, który Ci podaliśmy', 'apipass' => 'ten, który Ci podaliśmy', 'from' => 'sender@example.com', 'to' => 'recipient@example.com', 'subject' => 'temat wiadomości', 'text' => 'treść wiadomości e-mail w postaci zwykłego tekstu', 'html' => 'treść wiadomości e-mail w formacie HTML'); // użyj klucza 'http', nawet jeśli żądanie wysyłasz do https://... $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data), ), ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); var_dump($result); ?>

Metoda CURL
żądania POST

curl -d 'apiuser=ten, który Ci przekazaliśmy&apipass=ten, który Ci przekazaliśmy&from=sender@example.com&to=recipient@example.com&subject=temat wiadomości&text=treść wiadomości e-mail w postaci zwykłego tekstu&html=treść wiadomości e-mail w formacie HTML'https://rsXXX-api.realsender.com/mail/send

Przykłady API z załącznikami