Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. {
  2. "sm_api_error": 1
  3. "sm_api_message": "INSUFFICIENT VARIABLES"
  4. }
  5.  
  6. $long_article = "Long article text goes here";
  7.  
  8. $ch = curl_init("http://api.smmry.com/&SM_API_KEY=NNNNNNNNNN&SM_LENGTH=14&SM_WITH_BREAK");
  9. // IMPORTANT!
  10. curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect:"));
  11. // IMPORTANT! Without ^this^ any article over 1000 characters will make SMMRY throw a 417 http error
  12. curl_setopt($ch, CURLOPT_POST, true);
  13. curl_setopt($ch, CURLOPT_POSTFIELDS, "sm_api_input=".$long_article);// Your variable is sent as POST
  14. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  15. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  16. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
  17. curl_setopt($ch, CURLOPT_TIMEOUT, 20);
  18. $return = json_decode(curl_exec($ch), true);//You're summary is now stored in $return['sm_api_content'].
  19. curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement