function _disqus_migrate_api_request in Disqus 6
Helper function to send the API requests to Disqus
File
- ./
disqus_migrate.module, line 105
Code
function _disqus_migrate_api_request($resource, $parameters = array(), $method = 'GET', $include_forum = TRUE) {
if ($include_forum) {
$parameters['forum'] = variable_get('disqus_domain', '');
}
// Build the request URI and query
$data = http_build_query($parameters, '', '&');
$url = 'http://disqus.com/api/3.0/' . $resource . '?' . $data;
$headers = array(
'Content-Type' => 'application/x-www-form-urlencoded',
);
// Send request and return response
$response = drupal_http_request($url, $headers, $method);
$content = $response->data;
$data = json_decode($content);
return $data;
}