Drupal - How to get remote webpage content with drupal http request?

First, you can read the documentation about drupal_http_request() its pretty well documented and it will help you.

But for simple application, you can just do it like that.

<?php
$result = drupal_http_request('http://google.com/');
if (in_array( $result->code, array(200, 304))) {
  // Use $result->data for the content
}
else {
  // Error $result->code
}

// Also you can see all content from $result with
// if you had installed Devel Module and enable it
// dsm($result)
// or simply like that drupal_set_message('<pre>' . print_r($result, 1) . '</pre>');

Tags:

Http Request