Last active
December 16, 2016 17:32
-
-
Save zeryx/b5eb0c2fb33c75256a326e038bf25952 to your computer and use it in GitHub Desktop.
posting a summarizer request with CURL
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
# A very simple PHP example that sends a HTTP POST to a algorithmia and summarizes text. | |
# | |
#available input content types: | |
# application/json for json | |
# text/plain for simple string | |
# application/octet-stream for binary | |
<?php | |
$ch = curl_init(); | |
$data ='Your big document of text to get summarized, you could import this as a file as well.'; | |
curl_setopt_array($ch, array( | |
CURLOPT_RETURNTRANSFER => 1, | |
CURLOPT_URL => 'https://api.algorithmia.com/v1/algo/nlp/Summarizer/0.1.3', | |
CURLOPT_HTTPHEADER => array('Content-Type:application/text', 'Authorization: Simple <ALGORITHMIA_API_KEY_HERE'), | |
CURLOPT_POSTFIELDS => $data, | |
CURLOPT_POST => 1, | |
CURLOPT_RETURNTRANSFER => true | |
) | |
); | |
$server_output = curl_exec ($ch); | |
printf($server_output); | |
curl_close ($ch); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment