public function exec()
{
$verb = strtoupper($this->resource->getVerb());
$this->buildDefaultHeaders();
$curlHandler = curl_init();
//curl_setopt_array($curlHandler, $this->options);
// workaround for issue njasm/soundcloud#28 on github.
// for some reason curl_setopt_array does not wanna work well with 7.0 on some PHP builds.
// needs further investigation.
foreach ($this->options as $index => $value) {
curl_setopt($curlHandler, $index, $value);
}
curl_setopt($curlHandler, CURLOPT_USERAGENT, $this->getUserAgent());
curl_setopt($curlHandler, CURLOPT_CUSTOMREQUEST, $verb);
curl_setopt($curlHandler, CURLOPT_URL, $this->urlBuilder->getUrl());
if ($verb != 'GET') {
curl_setopt($curlHandler, CURLOPT_POSTFIELDS, $this->getBodyContent());
}
$response = curl_exec($curlHandler);
$info = curl_getinfo($curlHandler);
$errno = curl_errno($curlHandler);
$errorString = curl_error($curlHandler);
curl_close($curlHandler);
$this->options[CURLOPT_HTTPHEADER] = array();
return $this->factory->make('ResponseInterface', array($response, $info, $errno, $errorString));
}