home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (http.php)

This example Drupal source code file (http.php) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

_server, array, bootstrap, drupal_bootstrap, drupal_root, exit, forbidden, foreach, header, key, menu_execute_active_handler, null, php, value

The http.php Drupal example source code

// $Id: http.php,v 1.1 2010/11/05 19:05:02 dries Exp $

 * @file
 * Fake an HTTP request, for use during testing.

// Set a global variable to indicate a mock HTTP request.
$is_http_mock = !empty($_SERVER['HTTPS']);

// Change to HTTP.
ini_set('session.cookie_secure', FALSE);
foreach ($_SERVER as $key => $value) {
  $_SERVER[$key] = str_replace('modules/simpletest/tests/http.php', 'index.php', $value);
  $_SERVER[$key] = str_replace('https://', 'http://', $_SERVER[$key]);

// Change current directory to the Drupal root.
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';

// Make sure this file can only be used by simpletest.
if (!drupal_valid_test_ua()) {
  header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');


Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal http.php source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.