Skip to content

Instantly share code, notes, and snippets.

@remcotolsma
Created November 20, 2014 09:13
Show Gist options
  • Save remcotolsma/76a1c5128bd63d7abcdd to your computer and use it in GitHub Desktop.
Save remcotolsma/76a1c5128bd63d7abcdd to your computer and use it in GitHub Desktop.
WordPress HTTP API test for WordPress Pay (Qantani and Mollie)
<?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