Created
November 20, 2014 09:13
-
-
Save remcotolsma/76a1c5128bd63d7abcdd to your computer and use it in GitHub Desktop.
WordPress HTTP API test for WordPress Pay (Qantani and Mollie)
This file contains hidden or 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 | |
define( 'WP_USE_THEMES', false ); | |
require '../../../wp-blog-header.php'; | |
// HTTP | |
$http = _wp_http_get_object(); | |
echo '<h2>_wp_http_get_object()</h2>'; | |
echo '<pre>'; | |
var_dump( $http ); | |
echo '</pre>'; | |
$transport = $http->_get_first_available_transport( array( 'method' => 'POST' ) ); | |
echo '<h2>$http->_get_first_available_transport()</h2>'; | |
echo '<pre>'; | |
var_dump( $transport ); | |
echo '</pre>'; | |
// Test 1 | |
$url = 'https://www.qantanipayments.com/api/'; | |
$args = array( | |
'method' => 'POST', | |
); | |
$result = wp_remote_request( $url, $args ); | |
printf( "<h2>wp_remote_request( '%s' );</h2>", $url ); | |
echo '<pre>'; | |
var_dump( $result ); | |
echo '</pre>'; | |
// Test 2 | |
$url = 'https://www.qantanipayments.com/api/'; | |
$result = wp_remote_post( $url ); | |
printf( "<h2>wp_remote_post( '%s' );</h2>", $url ); | |
echo '<pre>'; | |
var_dump( $result ); | |
echo '</pre>'; | |
// Test 3 | |
$url = 'https://api.mollie.nl/v1/'; | |
$result = wp_remote_post( $url ); | |
printf( "<h2>wp_remote_post( '%s' );</h2>", $url ); | |
echo '<pre>'; | |
var_dump( $result ); | |
echo '</pre>'; | |
// Test 4 | |
$url = 'http://example.com/'; | |
$result = wp_remote_get( $url ); | |
printf( "<h2>wp_remote_get( '%s' );</h2>", $url ); | |
echo '<pre>'; | |
var_dump( $result ); | |
echo '</pre>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment