Last active
June 7, 2021 15:27
-
-
Save kartikparmar/13575c5573620af8e7f04e3cf05dcd0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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