|
<?php
$data
=
http_build_query(
array
(
'Username' => 'SampleUsername',
'Password' => 'SamplePassword',
'ProductId' => '00000000-0000-0000-0000-000000000000',
'Ids1' => '00000000-0000-0000-0000-000000000000',
)
);
$opts = array('http' =>
array
(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $data
)
);
$context = stream_context_create($opts);
$result = file_get_contents('https://api.westfax.com/Polka.Api/REST/GetFaxStatus', false, $context);
print($result);
?>
|
|
string username = "SampleUsername";
string password = "SamplePassword";
Guid productId = new Guid("00000000-0000-0000-0000-000000000000");
string jobName = "Job Name";
string billingCode = "Billing Code";
string header = "To: John Doe From: Jane Smith";
string[] phoneNumbers = new string[] { "5555555555" };
string CSID = "5555555555";
PolkaApi.FaxQuality faxQuality = PolkaApi.FaxQuality.Normal;
DateTime startDateTime = DateTime.UtcNow;
string feedbackEmail = "janesmith@company.com";
string filePath = @"C:\DocumentToBeFaxed.tif";
//
// Create the object for the fax document
//
PolkaApi.FileContainer fileContainer = new Polka.Api.DemoApp.PolkaApi.FileContainer();
fileContainer.Filename = Path.GetFileName(filePath);
fileContainer.FileContents = File.ReadAllBytes(filePath);
fileContainer.ContentLength = fileContainer.FileContents.Length;
//
// Initialize the web servce
//
PolkaApi.SoapWebService webService = new Polka.Api.DemoApp.PolkaApi.SoapWebService();
webService.Url = "https://api.westfax.com/Polka.Api/SOAP/";
try {
//
// Submit the fax to the API
//
PolkaApi.ApiResultOfString result = webService.SendFax(username, password, productId, jobName, billingCode, header, phoneNumbers, new PolkaApi.FileContainer[] { fileContainer }, CSID, faxQuality, startDateTime, feedbackEmail);
if (result.Success == true)
{
Console.WriteLine("Job Submitted Successfully!\r\n" + result.Result);
}
else
Console.WriteLine("Job Submission Failed.\r\n" + result.ErrorString);
}
catch (Exception ex)
{
Console.WriteLine("Job Submission Failed.\r\n" + ex.Message);
}
|