Created
November 15, 2017 16:25
-
-
Save holisticnetworking/1f8a4920ee531ac267c2c3d30605c61b to your computer and use it in GitHub Desktop.
Sending CuRL to Open Calais
This file contains 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
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