public function TwitterAPIExchange::setPostfields in Heartbeat 8
Set postfields array, example: array('screen_name' => 'J7mbo')
Parameters
array $array Array of parameters to send to API:
Return value
TwitterAPIExchange Instance of self for method chaining
Throws
\Exception When you are trying to set both get and post fields
1 call to TwitterAPIExchange::setPostfields()
- TwitterAPIExchange::request in modules/
statusmessage/ includes/ TwitterAPIExchange.php - Helper method to perform our request
File
- modules/
statusmessage/ includes/ TwitterAPIExchange.php, line 110
Class
- TwitterAPIExchange
- Twitter-API-PHP : Simple PHP wrapper for the v1.1 API
Code
public function setPostfields(array $array) {
if (!is_null($this
->getGetfield())) {
throw new Exception('You can only choose get OR post fields (post fields include put).');
}
if (isset($array['status']) && substr($array['status'], 0, 1) === '@') {
$array['status'] = sprintf("\0%s", $array['status']);
}
foreach ($array as $key => &$value) {
if (is_bool($value)) {
$value = $value === true ? 'true' : 'false';
}
}
$this->postfields = $array;
// rebuild oAuth
if (isset($this->oauth['oauth_signature'])) {
$this
->buildOauth($this->url, $this->requestMethod);
}
return $this;
}