WestFax is a leading provider of Fax Broadcasting, also called Broadcast Fax. We can blast document to thousands of fax number in minutes. WestFax is providing Online Fax Service with HIPPA compliant solution which is really great for Health Care Industry.
Read: Top 5 Best Online Fax Service Providers
Steps to Integrate WestFax API with PHP
Download WestFax.class.php file and include this PHP file using include function. Create an object of WestFax class.
1 2 3 4 5 6 7 |
include_once('WestFax.class.php'); /* First: Product Id (Provided by WestFax) Second: Username Third: Password */ $objWestFax = new WestFax('8c89x2c7-2a7a-47d3-9336-e4072d484ed6', '8UaMPvbR', 'jYU68jxG'); |
Send a Fax
To send a Fax using WestFax API call sendFax function and pass the argument as mention below
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
/* 1. Cover From 2. Document Path 3. Phone Numbers in array Ex. array('12345678') 4. Job Name 5. Billing Code */ $strCoverFrom = 'Test Cover For Fax'; $strDocument = 'LearnwithGoogle.pdf'; $arrPhoneNumber = array('5105868243'); $strJobName = 'First Test Job'; // Send Fax $arrSendFaxResponse = $objWestFax->sendFax($strCoverFrom, $strDocument, $arrPhoneNumber, $strJobName); if($arrSendFaxResponse['ApiResultOfString']['Success'] == 'true') { $strJobId = $arrSendFaxResponse['ApiResultOfString']['Result']; echo $strJobId; } else { echo $arrSendFaxResponse['ApiResultOfString']['ErrorString']; } |
We will get Job Id in response. Store this job id in a database to get a fax status or any other fax information in future.
If you want to send a document to thousands of fax number then you can pass all numbers in $arrPhoneNumber variable. WestFax will send this document to thousands of number within a min.
Get a Fax Status
To get a fax status call getFaxStatus function as mentioned below
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
/* Argument: Job ID */ $strJobId = 'bcfd4b37-ffaf-4ffa-bab9-ddfb776a0620'; // Receive Fax Status $arrFaxStatus = $objWestFax->getFaxStatus($strJobId); if($arrFaxStatus['ApiResultOfListOfJobStatusContainer']['Success'] == 'true') { $arrFaxPhoneStatus = $arrFaxStatus['ApiResultOfListOfJobStatusContainer']['Result']['JobStatusContainer']['Calls']['CallContainer']; // For single Fax Number if(array_key_exists('CallResult',$arrFaxPhoneStatus)) { $strPhoneNo = $arrFaxPhoneStatus['PhoneNumber']; $strFaxStatus = $arrFaxPhoneStatus['CallResult']; echo $strPhoneNo.' - '.$strFaxStatus; } // For multiple fax number else { for($intFax = 0; $intFax < count($arrFaxPhoneStatus); $intFax++) { $strPhoneNo = $arrFaxPhoneStatus[$intFax]['PhoneNumber']; $strFaxStatus = $arrFaxPhoneStatus[$intFax]['CallResult']; echo $strPhoneNo.' - '.$strFaxStatus.'<br/>'; } } } else { echo $arrFaxStatus['ApiResultOfListOfJobStatusContainer']['ErrorString']; } |
If fax was sent to multiple fax numbers then we will get fax status for all those numbers.
You can download West API code with all examples by clicking on below link
Download code to Integrate WestFax API PHP
Let me know if you need any help in WestFax API Integration. Happy to help.
Happy WestFaxing 🙂
You may also like
May 23, 2018 at 6:40 pm
Thanks for reviewing the WestFax product!