WordPress at Your Fingertips
function is not described

WC_Auth::post_consumer_data() protected WC 2.4.0

Post consumer data.

{} It's a method of the class: WC_Auth{}

No Hooks.

Return

true|false.

Usage

// protected - for code of main (parent) or child class
$result = $this->post_consumer_data( $consumer_data, $url );
$consumer_data(array) (required)
Consumer data.
$url(string) (required)
URL.

Changelog

Since 2.4.0 Introduced.

Code of WC_Auth::post_consumer_data() WC 5.8.0

protected function post_consumer_data( $consumer_data, $url ) {
	$params = array(
		'body'    => wp_json_encode( $consumer_data ),
		'timeout' => 60,
		'headers' => array(
			'Content-Type' => 'application/json;charset=' . get_bloginfo( 'charset' ),
		),
	);

	$response = wp_safe_remote_post( esc_url_raw( $url ), $params );

	if ( is_wp_error( $response ) ) {
		throw new Exception( $response->get_error_message() );
	} elseif ( 200 !== intval( $response['response']['code'] ) ) {
		throw new Exception( __( 'An error occurred in the request and at the time were unable to send the consumer data', 'woocommerce' ) );
	}

	return true;
}