Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
$consumer_key = 'ck_b6dab226d72e3b3da3462f9b51bc672b886f8f85';
$consumer_secret = 'cs_912b18aeedb2883a9c53f877a3c77fc7c0082fc4';
$url = rest_url( 'wp/v2/bkap-bookings/16180/' );
$url = add_query_arg(
array(
'consumer_key' => $consumer_key,
'consumer_secret' => $consumer_secret
),
$url
);
$response = wp_remote_get( $url, array( 'sslverify' => false ) );
// Check the response code.
if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ) {
// If not a 200, HTTP request failed.
die( 'There was an error attempting to access the API.' );
}
$bookings = json_decode( wp_remote_retrieve_body( $response ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment