Dizzy Docs
logo logo
  • Home
  • Documents
    • API

      All API Documentation

    • Chatty

      Chat App

    • PDO

      Everything PDO

    • Vici

      Tutorials & Courses

    • Coding

      Everything Coding

    • Tech Stuff

      Geek Out

    • Random

      Docs with no Home

    • Business Workflows

      Everything we need to know for work

  • Notes
  • Manual
logo logo
Free Trail


Doc Navigation

  • Getting Started
  • briefcase DizzyDoc Samples
  • briefcase Generate PDF
  • briefcase SR Fax
Folder Structure

public_html/pdf/faxes/get_status.php

public_html/pdf/faxes/queue_fax.php

public_html/pdf/faxes/srFax_class.php


get_status.php
			    
				//*** BE SURE TO INCLUDE THE PHP TAG AT BEGINNING AND THE END OF THE FILE ***
				//*** In Credentials keep the quote marks ***

				 /* 
				 * SRFax API Example - Retrieve a fax's status using the srFax Class 
				 */ 
 
				require_once ("srFax_class.php"); 
	 
				$accountID        = "account_number"; 
				$accountPassword  = "password";  
 
				// instantiate object with Account ID and Password 
				$srFax = new srFax ( $accountID, $accountPassword ); 
 
				try { 
     
				    $srFax->Get_FaxStatus(array( 
				      'sFaxDetailsID' => '935857647', 
				    )); 
				} 
				catch (Exception $e) { // display error when exception is thrown 
				    die("Error: $e"); 
				} 
 
				if ( $srFax->getRequestStatus () ) { 
				    //Success! Output Fax Details 
				    $response = $srFax->getRequestResponse (); 
     
				    echo "Fax Details: 
\n"; echo "FileName: " . $response->FileName . "
\n"; echo "Status: " . $response->SentStatus . "
\n"; echo "Date Queued: " . $response->DateQueued . "
\n"; echo "Date Sent: " . $response->DateSent . "
\n"; echo "Number of Pages: " . $response->Pages . "
\n"; } else { echo "ERROR: " . $srFax->getRequestResponse (); }
queue_fax.php
			    
				//*** BE SURE TO INCLUDE THE PHP TAG AT BEGINNING AND THE END OF THE FILE ***
				//*** In Credentials keep the quote marks ***

				/* 
				 * SRFax API Example - Queue a fax using the srFax Class 
				 */ 
 
				require_once ("srFax_class.php"); 
 
				$accountID        = "account_number"; 
				$accountPassword  = "password"; 
 
				// instantiate object with Account ID and Password 
				$srFax = new srFax ( $accountID, $accountPassword ); 
				 
				//Get file contents for the fax 
				//$file1Name     = "SRFax-Fax-API-Documentation.pdf"; 
				$file1Name     = "$filled"; 
				$file1Contents = base64_encode(file_get_contents("$file1Name")); 
 
				//$file2Name     = "TestImage.jpg"; 
				//$file2Contents = base64_encode(file_get_contents("Files/$file2Name")); 
 
				//Setup required variables 
				$senderFaxNumber   = "account_fax_number"; 
				$senderEmail       = "account_email"; 
				$receiverFaxNumber = "$pcp_fax"; 

				//$receiverFaxNumber = "18446014451907"; 
 
				try { 
				    // attempt to queue a fax 
				    $srFax->Queue_Fax(array( 
				      'sCallerID'      => $senderFaxNumber, 
				      'sSenderEmail'   => $senderEmail, 
				      'sFaxType'       => 'SINGLE', 
				      'sToFaxNumber'   => $receiverFaxNumber, 
				      'sFileName_1'    => $file1Name, 
				      'sFileContent_1' => $file1Contents, 
				     // 'sFileName_2'    => $file2Name, 
				     // 'sFileContent_2' => $file2Contents, 
				    )); 
				} 
				catch (Exception $e) { // display error when exception is thrown 
				    die("Error: $e"); 
				} 
			 
 
 
				if ( $srFax->getRequestStatus () ) { 
	     
				    echo "Success! Fax Details ID = " . $srFax->getRequestResponse (); 
				    $faxid = $srFax->getRequestResponse ();
				    // Update status
				    $update = "UPDATE kto_records SET status_fax = 'Sent! FaxID $faxid' WHERE pcp_fax = '$pcp_fax'";
				            if ($result = $link->query($update)) { 
				                echo "Fax status updated successfully";
				            } else {
				            echo "Error updating fax status: " . $conn->error;
				            }
	
				} else { 
				    echo "ERROR: " . $srFax->getRequestResponse (); 
				    $error = $srFax->getRequestResponse ();
				    $update = "UPDATE kto_records SET status_fax = 'Error: $error' WHERE pcp_fax = '$pcp_fax'";
				            if ($result = $link->query($update)) { 
				                echo "Fax status updated successfully";
				            } else {
				            echo "Error updating fax status: " . $conn->error;
				            }
				} 
 

				}
			    
			  

© 2020 All Rights Reserved by KbDoc

Video Playback Not Supported