Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function GetAttachment($MessageGroupID, $MessageUid, $ContentKey = "image-data-0", $ContentType = "image/jpeg")
- {
- $headers = array(
- 'Authorization: Bearer ' . $this->oauth,
- 'Content-Type: ' . $ContentType,
- 'Content-Transfer-Encoding: binary'
- );
- $response = \Utilities::SendRequest(MESSAGE_URL . '/' . $MessageGroupID . '/messages/' . $MessageUid . '?contentKey=' . $ContentKey, $headers, false, null, "GET", null);
- $data = base64_encode($response['body']);
- return $data;
- }
- // Get Audio
- if (!file_exists($FullAudio))
- {
- $AudioData = base64_decode($MessageAPI->GetAttachment($MessageGroupID, $Messages->messages[$i]->messageUid, "voice-data-0", "audio/mpeg"));
- $fp = fopen($FullAudio, 'x');
- fwrite($fp, $AudioData);
- fclose($fp);
- }
- // Set Path to Audio
- $Audio = '<audio controls>';
- $Audio .= '<source src="/psn/audio/' . $FullAudioName . '" type="audio/mpeg">';
- $Audio .= 'Your browser does not support the audio tag.';
- $Audio .= '</audio>';
- $Content .= $Audio;
Add Comment
Please, Sign In to add comment