Skip to content

Instantly share code, notes, and snippets.

@mnelson4
Created September 14, 2017 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnelson4/e781891b63e077f43826e91ddf46205f to your computer and use it in GitHub Desktop.
Save mnelson4/e781891b63e077f43826e91ddf46205f to your computer and use it in GitHub Desktop.
Code using the WP HTTP API to post to the EE4 REST API
$response = wp_remote_request(
'http://src.wordpress-develop.dev/wp-json/ee/v4.8.36/answers',
array(
'method' => 'POST',
'headers' => array(
'Authorization' => 'Basic ' . base64_encode( YOUR_USERNAME . ':' . YOUR_PASSWORD ),
),
'body' => array(
'REG_ID' =>1,
'QST_ID' => 10,
'ANS_value' => 'Alderan'
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment