By nahids29 on
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
HTTP result codes
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.
how will i know
how will i know 200 is the valid data not 201 or any other number?!
The code is looking up the
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
$http_result->code always
$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.