I am trying to use an API and I am not getting anywhere. The documention says "The document to fax is written directly to the Request Input Stream in binary format"
I have tried using examples from the web like....
$xSendURL = 'http:/example.com/default.ashx?OPT=SendFax&UserName=johndoe...';
# New data
$data = array('FileData' => '@/DATA/html/sites/support/FAAPI/TEST.TIF');
# Create a connection
$ch = curl_init();
# Setting our options
curl_setopt($ch, CURLOPT_URL, $xSendURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
# Get the response
$response = curl_exec($ch);
curl_close($ch);
But when I check the file that is created on the server the contents of the file is the path that I defined for the $data variable. (@/DATA/html/sites/support/FAAPI/TEST.TIF)
I am very new at php. I looked into php://input and php://outout but I am not sure if that would work.
On the URL that I use to invoke the API I pass the filename, username, and security tokens I am not sure how I would grab the Request Input Stream to upload the file after opening the URL.
Any help is appreciated.
Thanks