From bfa4fed82b46a40dde3a8a400602dba2b93f4260 Mon Sep 17 00:00:00 2001 From: Abraham Lincoln Date: Sun, 23 Nov 2014 00:13:38 -0600 Subject: [PATCH 1/2] Fix setStory() returning false --- src/snapchat.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/snapchat.php b/src/snapchat.php index fe64534..92c58cc 100755 --- a/src/snapchat.php +++ b/src/snapchat.php @@ -939,8 +939,8 @@ public function send($media_id, $recipients, $time = 3) { * @param int $time * The time in seconds the story should be available (1-10). Defaults to 3. * - * @return bool - * TRUE if successful, FALSE otherwise. + * @return mixed + * The story data or FALSE on failure. */ public function setStory($media_id, $media_type, $time = 3) { // Make sure we're logged in and have a valid access token. @@ -965,7 +965,7 @@ public function setStory($media_id, $media_type, $time = 3) { ) ); - return is_null($result); + return $result; } /** From 80a06a7953166c1fa65062f4e38a8bb68525c36a Mon Sep 17 00:00:00 2001 From: Abraham Lincoln Date: Sun, 23 Nov 2014 00:13:41 -0600 Subject: [PATCH 2/2] Fix setStory() returning false --- src/snapchat_agent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/snapchat_agent.php b/src/snapchat_agent.php index 1dc22a9..c8027e9 100644 --- a/src/snapchat_agent.php +++ b/src/snapchat_agent.php @@ -309,7 +309,7 @@ public function post($endpoint, $data, $params, $multipart = FALSE) { // If the cURL request fails, return FALSE. Also check the status code // since the API generally won't return friendly errors. - if ($result === FALSE || curl_getinfo($ch, CURLINFO_HTTP_CODE) != 200) { + if ($result === FALSE || (curl_getinfo($ch, CURLINFO_HTTP_CODE) != 200 && curl_getinfo($ch, CURLINFO_HTTP_CODE) != 202)) { curl_close($ch); return FALSE; }