Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setStory() always returning false #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/snapchat.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -965,7 +965,7 @@ public function setStory($media_id, $media_type, $time = 3) {
)
);

return is_null($result);
return $result;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/snapchat_agent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down