Skip to content

Commit

Permalink
Merge pull request #99 from coop182/patch-3
Browse files Browse the repository at this point in the history
URL decode response body before checking 503 error message
  • Loading branch information
calcinai committed Sep 22, 2015
2 parents 5be82a6 + fbb8c03 commit bfe2289
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/XeroPHP/Remote/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ public function parse() {
case Response::STATUS_RATE_LIMIT_EXCEEDED:
case Response::STATUS_ORGANISATION_OFFLINE:
//There must be a better way than this?
if(false !== stripos($this->response_body, 'Organisation is offline')){
$response = urldecode($this->response_body);
if(false !== stripos($response, 'Organisation is offline')){
throw new OrganisationOfflineException();
} elseif(false !== stripos($this->response_body, 'Rate limit exceeded')){
} elseif(false !== stripos($response, 'Rate limit exceeded')){
throw new RateLimitExceededException();
} else {
throw new NotAvailableException();
Expand Down Expand Up @@ -263,4 +264,4 @@ public function parseHTML() {
}


}
}

0 comments on commit bfe2289

Please sign in to comment.