-
-
Save mikejolley/0941e0882efcad64ea40 to your computer and use it in GitHub Desktop.
<?php | |
/** | |
* Plugin Name: PayPal Sandbox IPN Tester | |
* Description: Pings the IPN endpoint to see if your server can connect. Just head to <a href="/?ipn-test=1">yoursite.com/?ipn-test=1</a> whilst logged in as admin. | |
* Version: 1.0.0 | |
* Author: WooThemes | |
* Requires at least: 4.1 | |
* Tested up to: 4.3 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
add_action( 'wp_loaded', 'paypal_sandbox_ipn_tester' ); | |
function paypal_sandbox_ipn_tester() { | |
if ( ! empty( $_GET['ipn-test'] ) && current_user_can( 'manage_options' ) ) { | |
$response = wp_safe_remote_post( 'https://www.sandbox.paypal.com/cgi-bin/webscr', array( | |
'body' => array( | |
'test_ipn' => 1, | |
'cmd' => '_notify-validate' | |
) | |
) ); | |
if ( ! is_wp_error( $response ) ) { | |
wp_die( 'SUCCESS' ); | |
} else { | |
wp_die( 'FAIL - ' . $response->get_error_message() ); | |
} | |
} | |
} |
No, they can't. Shared hosting environments need to consider more than just WordPress, as described here:
https://core.trac.wordpress.org/ticket/36320#comment:7
But here is my tentative fix anyway:
function rbst_http_api_transports() {
return array( 'streams', 'curl' );
}
add_filter( 'http_api_transports', 'rbst_http_api_transports', 9999 );
@reidbiztech, I just copied the code in one of my plugins and tested via IPN Simulator. No luck.
Can you let me know where to past this code ? Also, I am using a relative old php version 5.4 . Could that be an issue ?
thanks for your input.
Mike
so interestingly, before adding your code to my plugin I received this error:
SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
after adding your code I receive this error:
FAIL - The SSL certificate for the host could not be verified.
Can you make sense of this ? Any idea where to go from here ?
thanks a lot,
Mike
@reidbiztech versions older than that can be disabled at host level. TBH, those older standards should be disabled anyway because they are nowhere near as secure.
WooCommerce core does set httpversion to 1.1. That part isn't an issue.