You can create an HTTP triggered Cloud Function. For more information go to HTTP Triggers documentation. Then make an http request form your PHP code using the function's trigger URL. To see it go to Cloud Functions page in Google Cloud Console. Click on your Cloud Function's name and the Function details page will open. Go to the Trigger tab and under URL you can see the link to execute the Cloud Function.
An PHP example to do so could be as follows (It is one of many, and that is what worked for me): Run sudo apt-get install php-curl to install php curl
Use the following PHP code:
<?php global $url; //The Cloud Function's trigger URL $url = "www.[FUNCTION_ZONE]-[PROJECT_ID].cloudfunctions.net/[FUNCTION_NAME]"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // Set so curl_exec returns the result instead of outputting it. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Get the response and close the channel. $response = curl_exec($ch); echo "Printing response: \n\n"; echo $response; curl_close($ch);