| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
All code in the snippets directory demonstrate how to invoke Cloud Tasks from PHP.
src/create_http_task.php is a simple function to create tasks with an HTTP target.
Enable APIs - Enable the Cloud Tasks API and create a new project or select an existing project.
Download The Credentials - Click "Go to credentials" after enabling the APIs. Click "New Credentials" and select "Service Account Key". Create a new service account, use the JSON key type, and select "Create". Once downloaded, set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of the JSON key that was downloaded.
Clone the repo and cd into this directory
$ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
$ cd php-docs-samples/tasksInstall dependencies via Composer. Run php composer.phar install (if composer is installed locally) or composer install (if composer is installed globally).
Create a Queue To create a queue using the Cloud SDK, use the following gcloud command:
gcloud tasks queues create <QUEUE_NAME>Run php src/create_http_task.php. The usage will print for each if no arguments are provided:
$> php src/create_http_task.php Usage: php src/create_http_task.php PROJECT_ID LOCATION_ID QUEUE_ID URL [PAYLOAD]
where:
| Back | FazBrowse Home | New Git URL |