1. Home
  2. For Devs
  3. How to use cURL to call a webhook using a receivable URL

How to use cURL to call a webhook using a receivable URL

You can programmatically call a webhook from within any PHP environment that supports cURL.

Get started

The first step is to obtain the receivable URL from the trigger of your choice. When using Flows or Webhook triggers, you will find the receivable URL within the settings of the endpoint.

Call the URL via cURL

To call the receivable URL using cURL, you can use a snippet similar to this one.

// Set the API endpoint URL
$url = "https://yourdomain.com/the-receivable-webhook-url";

// Set the POST data of your choice
$data = array(
	'name'     => 'John Doe',
	'email'    => '[email protected]',
	'password' => 'mypassword',

// Initialize cURL.
$ch = curl_init();

// Set the cURL options for POST call.
		CURLOPT_URL            => $url,
		CURLOPT_POST           => true,
		CURLOPT_POSTFIELDS    => http_build_query( $data ),

// Execute the cURL call.
$response = curl_exec( $ch );

// Check for any errors.
if ( curl_errno( $ch ) ) {
	echo 'Error: ' . curl_error( $ch );
} else {
	echo 'Response: ' . $response;

// Close the cURL session.
curl_close( $ch );

Whenever this snippet is called, the receivable URL within WP Webhooks will cause the trigger to fire with the data you sent along.

Updated on April 6, 2023

Was this article helpful?

Related Articles