Skip to content

Instantly share code, notes, and snippets.

@remcotolsma
Created June 22, 2015 13:52
Show Gist options
  • Save remcotolsma/3e8ab472da877aba0566 to your computer and use it in GitHub Desktop.
Save remcotolsma/3e8ab472da877aba0566 to your computer and use it in GitHub Desktop.
Simulate OmniKassa automatic response message with WordPress
<?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