question

nibu-eapen10876 avatar image
nibu-eapen10876 asked

php sample code to retrieving message attachments

I would like to know how I can read response body and save to file.

RingCentral\SDK\Http\ApiResponse Object  (      [_jsonAsArray:protected] =>       [_jsonAsObject:protected] =>       [_multiparts:protected] =>       [_response:protected] => GuzzleHttp\Psr7\Response Object          (              [reasonPhrase:GuzzleHttp\Psr7\Response:private] => OK              [statusCode:GuzzleHttp\Psr7\Response:private] => 200              [headers:GuzzleHttp\Psr7\Response:private] => Array                  (                      [Server] => Array                          (                              [0] => nginx                          )                        [Date] => Array                          (                              [0] => Tue, 07 Aug 2018 22:15:14 GMT                          )                        [Content-Type] => Array                          (                              [0] => text/plain;charset=utf-8                          )                        [Content-Length] => Array                          (                              [0] => 60                          )                        [Connection] => Array                          (                              [0] => keep-alive                          )                        [RCRequestId] => Array                          (                              [0] => 5bf03a88-9a8f-11e8-a6b9-005056bb26b9                          )                        [RoutingKey] => Array                          (                              [0] => SJC11P01PAS01                          )                        [Accept-Ranges] => Array                          (                              [0] => bytes                              [1] => bytes                          )                        [Content-Disposition] => Array                          (                              [0] => inline;filename=4622047004.txt                          )                        [Content-Language] => Array                          (                              [0] => en-US                          )                        [X-Rate-Limit-Group] => Array                          (                              [0] => medium                          )                        [X-Rate-Limit-Limit] => Array                          (                              [0] => 40                          )                        [X-Rate-Limit-Remaining] => Array                          (                              [0] => 38                          )                        [X-Rate-Limit-Window] => Array                          (                              [0] => 60                          )                    )                [headerNames:GuzzleHttp\Psr7\Response:private] => Array                  (                      [server] => Server                      [date] => Date                      [content-type] => Content-Type                      [content-length] => Content-Length                      [connection] => Connection                      [rcrequestid] => RCRequestId                      [routingkey] => RoutingKey                      [accept-ranges] => Accept-Ranges                      [content-disposition] => Content-Disposition                      [content-language] => Content-Language                      [x-rate-limit-group] => X-Rate-Limit-Group                      [x-rate-limit-limit] => X-Rate-Limit-Limit                      [x-rate-limit-remaining] => X-Rate-Limit-Remaining                      [x-rate-limit-window] => X-Rate-Limit-Window                  )                [protocol:GuzzleHttp\Psr7\Response:private] => 1.1              [stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object                  (                      [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #121                      [size:GuzzleHttp\Psr7\Stream:private] =>                       [seekable:GuzzleHttp\Psr7\Stream:private] => 1                      [readable:GuzzleHttp\Psr7\Stream:private] => 1                      [writable:GuzzleHttp\Psr7\Stream:private] => 1                      [uri:GuzzleHttp\Psr7\Stream:private] => php://temp                      [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array                          (                          )                    )            )        [_request:protected] => GuzzleHttp\Psr7\Request Object          (              [method:GuzzleHttp\Psr7\Request:private] => GET              [requestTarget:GuzzleHttp\Psr7\Request:private] =>               [uri:GuzzleHttp\Psr7\Request:private] => GuzzleHttp\Psr7\Uri Object                  (                      [scheme:GuzzleHttp\Psr7\Uri:private] => https                      [userInfo:GuzzleHttp\Psr7\Uri:private] =>                       [host:GuzzleHttp\Psr7\Uri:private] => platform.devtest.ringcentral.com                      [port:GuzzleHttp\Psr7\Uri:private] =>                       [path:GuzzleHttp\Psr7\Uri:private] => /restapi/v1.0/account/244580004/extension/244580004/message-store/4622047004/content/4622047004                      [query:GuzzleHttp\Psr7\Uri:private] =>                       [fragment:GuzzleHttp\Psr7\Uri:private] =>                   )                [headers:GuzzleHttp\Psr7\Request:private] => Array                  (                      [Host] => Array                          (                              [0] => platform.devtest.ringcentral.com                          )                        [content-type] => Array                          (                              [0] => application/json                          )                        [accept] => Array                          (                              [0] => application/json                          )                        [Authorization] => Array                          (                              [0] => bearer U0pDMTFQMDFQQVMwMHxBQUI3Q2pJU0F6QmZZTjVFM0lLVTk3RGRVN3RjSWlqQndiZm1qNHVxSmtiaWxLZVFEc2cweEUwb0h6ZkRKaHBTTE9GNF9QWWRPMEVYNEhPV3FzbEwwTUtuZDluN0F6ZmNHRTg4RWFEc3FFZ0lVSFdWdnU5RlJERTg3bmR2dVpoR0lUaUw2VnNtYTVMZzBsMWRBbjBPS3J0M0hsd09iX0MyajdBMG5rU2ozWk9MMHk3ZVBSMVhNNmJvQXk5QnB5ZkplVU18SzN0ZDJRfHJkX09IcnVvU1VfWXJlWVJSZlp2TUF8QUE                          )                        [User-Agent] => Array                          (                              [0] => Demo/1.0.0 Windows NT/10.0 PHP/5.6.31 RCPHPSDK/2.1.2                          )                        [RC-User-Agent] => Array                          (                              [0] => Demo/1.0.0 Windows NT/10.0 PHP/5.6.31 RCPHPSDK/2.1.2                          )                    )                [headerNames:GuzzleHttp\Psr7\Request:private] => Array                  (                      [content-type] => content-type                      [accept] => accept                      [host] => Host                      [authorization] => Authorization                      [user-agent] => User-Agent                      [rc-user-agent] => RC-User-Agent                  )                [protocol:GuzzleHttp\Psr7\Request:private] => 1.1              [stream:GuzzleHttp\Psr7\Request:private] => GuzzleHttp\Psr7\Stream Object                  (                      [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #119                      [size:GuzzleHttp\Psr7\Stream:private] => 0                      [seekable:GuzzleHttp\Psr7\Stream:private] => 1                      [readable:GuzzleHttp\Psr7\Stream:private] => 1                      [writable:GuzzleHttp\Psr7\Stream:private] => 1                      [uri:GuzzleHttp\Psr7\Stream:private] => php://temp                      [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array                          (                          )                    )            )    )


getting started
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

0 Answers

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys