Skip to content

Instantly share code, notes, and snippets.

@holisticnetworking
Created November 15, 2017 16:25
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 holisticnetworking/1f8a4920ee531ac267c2c3d30605c61b to your computer and use it in GitHub Desktop.
Save holisticnetworking/1f8a4920ee531ac267c2c3d30605c61b to your computer and use it in GitHub Desktop.
Sending CuRL to Open Calais
if(!empty($this->post)) {
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $this->resource);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: {$this->content_type}",
"omitOutputtingOriginalText: {$this->omit_original}",
"outputFormat: {$this->output_type}",
"x-ag-access-token : {$this->api_token}",
"x-calais-contentClass: {$this->content_class}",
"x-calais-language: {$this->language}",
"x-calais-selectiveTags: {$this->tags}",
]);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, do_shortcode($this->post->post_content));
$result=curl_exec($ch);
curl_close($ch);
return json_decode($result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment