Created
June 22, 2015 13:52
-
-
Save remcotolsma/3e8ab472da877aba0566 to your computer and use it in GitHub Desktop.
Simulate OmniKassa automatic response message with WordPress
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'; | |
// Post | |
$url = 'https://www.example.com/'; | |
$data = 'key1=value1|key2=value2|key3=value3'; | |
$secret_key = '002020000000001_KEY1'; | |
$body = array( | |
'Data' => $data, | |
'InterfaceVersion' => 'HP_1.0', | |
'Seal' => hash( 'sha256', $data . $secret_key ), | |
); | |
$result = wp_remote_post( $url, array( | |
'user-agent' => 'Java/1.6.0_45', | |
'body' => $body, | |
) ); | |
var_dump( $result ); | |
echo '<textarea rows="50" cols="100">', esc_textarea( wp_remote_retrieve_body( $result ) ), '</textarea>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment