public function TwitterAPIExchange::setGetfield in Heartbeat 8
Set getfield string, example: '?screen_name=J7mbo'
Parameters
string $string Get key and value pairs as string:
Return value
\TwitterAPIExchange Instance of self for method chaining
Throws
\Exception
1 call to TwitterAPIExchange::setGetfield()
- TwitterAPIExchange::request in modules/
statusmessage/ includes/ TwitterAPIExchange.php - Helper method to perform our request
File
- modules/
statusmessage/ includes/ TwitterAPIExchange.php, line 150
Class
- TwitterAPIExchange
- Twitter-API-PHP : Simple PHP wrapper for the v1.1 API
Code
public function setGetfield($string) {
if (!is_null($this
->getPostfields())) {
throw new Exception('You can only choose get OR post / post fields.');
}
$getfields = preg_replace('/^\\?/', '', explode('&', $string));
$params = array();
foreach ($getfields as $field) {
if ($field !== '') {
list($key, $value) = explode('=', $field);
$params[$key] = $value;
}
}
$this->getfield = '?' . http_build_query($params, '', '&');
return $this;
}