Using Gravity Forms, I have a php form with a PDF file upload field. We pass the form data (json) to a third party API. However, it is sending the PDF as a url to the file, and we need to actually pass the contents of the PDF encoded in the body.
We can use the following filter to modify the request data before the webhook is set, but I don't know how to encode the actual file contents:
add_filter( 'gform_webhooks_request_data', 'modify_data', 10, 4 );
function modify_data( $request_data, $feed, $entry, $form ){
$request_data = // do something
return $request_data;
}
How is it possible to read the file contents of the PDF and base64 encode it?
Thank you!