Skip to main content
Question

PHP 5.2 Curl Fax Code Examples


So unfortunately I'm stuck on PHP 5.2.3 and cannot upgrade, thus cannot use the official PHP SDK. I need examples of how to set up the FaxOut after obtaining a valid Access Token. Been stuck for the past 3 days.

5 replies

I can show you how to do it with curl. You try to adjust it for PHP curl. 

curl
--header "Accept: application/json"
--header "Authorization: Bearer <token>"
-F "request=@request.json;type=application/json"
-F "attachment=@hello.txt;type=text/plain"
"https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/fax";


Content of request.json file:
{
"to": [{ "phoneNumber": <fax receiver> }]
}


Content of hello.txt:
<Whatever text you want to send.>


You can also send pdf:
-F "attachment=@test.pdf;type=application/pdf"


Been stuck for the past 3 days.
You should have asked for help earlier :)

  • Author
  • New Participant
  • 1 reply
  • June 18, 2018
But how do I translate that to PHP cURL lib?... such as using curl_init(), curl-setopt(), etc?

Ya, 1.5 days were stuck reading docs and the other 1.5 days were trying to implement things fruitlessly. 

  • 0 replies
  • June 18, 2018
Drew,

Try out my PHP "Lite" SDK. It's a 1-file, 0-dependency library designed to support older PHP and uses cURL.

You can see a fax example using the SDK here:

https://github.com/grokify/ringcentral-sdk-php-lite#send-a-fax

You can see the SDK's cURL code here:

https://github.com/grokify/ringcentral-sdk-php-lite/blob/master/src/ringcentrallite.php#L139

I don't have PHP 5.2.3, so let me know if it works for you.

Curl to PHP: https://incarnate.github.io/curl-to-php/

Update: I find that  it doesn't support '-F' at all, so ignore this one.

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings