Skip Navigation
Expand
Using PHP function file_get_contents
Answer ID 7445   |   Last Review Date 01/05/2022

Can I use the PHP function file_get_contents() within my Customer Portal pages and custom PHP scripts?

Environment:

Customer Portal all versions

Resolution:

PHP file_get_contents is supported when reading the PHP input stream (OCI and legacy pods), in both Customer Portal (custom CP controllers) and custom PHP scripts, as follows:

file_get_contents('php://input')

Further, when using the above with custom scripts, it is important to use the primary vhost for the site interface in the URL used to access the script. 

Otherwise, on legacy pods, file_get_contents is supported as long as the file URL uses HTTP.  However, it is not supported on OCI pods, as those do not allow traffic over port 80 (HTTP) and the PHP build does not support file_get_contents using HTTPS.