Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d5a4720

Browse files
add getBody
1 parent 865e61e commit d5a4720

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎App/Models/Http.php‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,22 @@ public function getStatus()
139139
return curl_getinfo($this->ch, CURLINFO_HTTP_CODE);
140140
}
141141

142+
/**
143+
* getBody - returns the response body
144+
*
145+
* @return string - the response body
146+
*/
147+
public function getBody()
148+
{
149+
curl_setopt($this->ch, CURLOPT_HEADER, 0);
150+
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
151+
$response = curl_exec($this->ch);
152+
if ($response === false) {
153+
throw new \Exception(curl_error($this->ch), curl_errno($this->ch));
154+
}
155+
return $response;
156+
}
157+
142158
/**
143159
* Encoding - sets the encoding(s) for the request
144160
*

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /