send(); if ($request->getResponse()->getStatus() == 301) { echo 'Redirect'; //Replace with what you want to do } } catch (HTTP_Request2_Exception $e) { echo 'Error: ' . $e->getMessage(); } ?>Package/Library: The second example code demonstrates using the is_redirect() function from the HTTP_PHP Library.