Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "sm_api_error": 1
- "sm_api_message": "INSUFFICIENT VARIABLES"
- }
- $long_article = "Long article text goes here";
- $ch = curl_init("http://api.smmry.com/&SM_API_KEY=NNNNNNNNNN&SM_LENGTH=14&SM_WITH_BREAK");
- // IMPORTANT!
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect:"));
- // IMPORTANT! Without ^this^ any article over 1000 characters will make SMMRY throw a 417 http error
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, "sm_api_input=".$long_article);// Your variable is sent as POST
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
- curl_setopt($ch, CURLOPT_TIMEOUT, 20);
- $return = json_decode(curl_exec($ch), true);//You're summary is now stored in $return['sm_api_content'].
- curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement