Automator_Send_Webhook::call_webhook( $webhook_url,  $args,  $request_type = 'POST' )


Parameters Parameters

$webhook_url

(Required)

$args

(Required)

$request_type

(Optional)

Default value: 'POST'


Top ↑

Return Return

(array|mixed|void|WP_Error)


Source Source

File: src/core/lib/webhooks/class-automator-send-webhook.php

	public static function call_webhook( $webhook_url, $args, $request_type = 'POST' ) {
		switch ( sanitize_text_field( wp_unslash( $request_type ) ) ) {
			case 'PUT':
			case 'POST':
			case 'DELETE':
				$response = wp_remote_post( $webhook_url, $args );
				break;
			case 'GET':
				$response = wp_remote_get( $webhook_url, $args );
				break;
			case 'HEAD':
				$response = wp_remote_head( $webhook_url, $args );
				break;
			default:
				$response = apply_filters( 'automator_send_webhook_default_response', wp_remote_post( $webhook_url, $args ), $webhook_url, $args );
				break;
		}

		return $response;
	}