hi im running drupal 6 on xampp

I have been reading this book drupal 6 module development and on page 58 i have this code which i really cant understand

if ($http_result->code == 200) {
// ...Process response code goes here...
// Otherwise we don't have any data
} else {
$msg = 'No content from %url.';
$vars = array( '%url' => $url );
watchdog('goodreads', $msg, $vars, WATCHDOG_WARNING);
return t("The bookshelf is not accessible.");
}

i dont understand the 200 in here...if u give other values then it wont work so pls help

Comments

yelvington’s picture

Google is your friend.
http://www.google.com/search?q=http%20result%20codes

If you get any response other than 200, you won't have valid data.

nahids29’s picture

how will i know 200 is the valid data not 201 or any other number?!

jamestombs’s picture

The code is looking up the response which is put in to $httprequest->code. If this is 200, it means the data has been sent/received fine and you can continue to process it.

James T
Action Medical Research - www.action.org.uk

James T
Action Medical Research - www.action.org.uk

ravisagar’s picture

$http_result->code always return 0 I dont know why this is happening. I checked the url, which is fine. I also tried other urls but again getting 0 instead of 200.