Skip to content

Instantly share code, notes, and snippets.

@fsvehla
Created August 12, 2011 11:42
Show Gist options
  • Save fsvehla/1141894 to your computer and use it in GitHub Desktop.
Save fsvehla/1141894 to your computer and use it in GitHub Desktop.
Faxonline API PHP Sample: Sending
<?php
$login = 'xxxxxxxx'; /* Username */
$password = 'xxxxxxxx'; /* Password */
$path = 'Test.pdf'; /* Path to file */
$recipient = '+43125330331115'; /* Recipient */
$handle = curl_init();
$url = 'https://' . $login . ':' . $password . '@faxonline.at/api-v1/faxes.json';
$data = array('document' => '@' . $path, 'recipient' => $recipient);
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($handle);
curl_close($handle);
$data = json_decode($response, true);
var_dump($data);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment