The mgiIncludeHTTP Tag

Tag Behavior

Use the mgiInclude HTTP tag to retrieve and display web page headers and content via HTTP. The mgiIncludeHTTP supports both the GET and POST methods. (see also mgiIncludeFile)


Tag Syntax

The mgiIncludeHTTP tag has one required parameter and six optional parameters. The tag form is:

<mgiIncludeHTTP url="URL" data="Type" method="Method" 
postArgumentName="Name" postArgumentValue="Value" 
username="Login" password="Password">

Required Parameters:

  • url - The url is the relative or absolute URL to the web page that you wish to include. The mgiIncludeHTTP tag cannot include data from a secure URL (e.g., URLs beginning with HTTPS).

Optional Parameters:

  • data - The data is the type of information to display from the included page. If the data parameter value is "headers", then the HTTP headers from the included page are displayed. If the data parameter value is "content", then the content of the included page is displayed. If the data parameter value is "headersAndContent", then the headers and the content of the included page are displayed. The default value is content.
  • method - The method is the method used to retrieve the page. If the method parameter value is "get", then the get method is used to retrieve the page. If the method parameter value is "post", then the post method is used to retrieve the page. The default value is get.
  • postArgumentName - The postArgumentName is the name of the post argument sent with the page request. You may include multiple postArgumentName parameters in one mgiIncludeHTTP tag. Each postArgumentName parameter must have a corresponding postArgumentValue parameter that is entered after the postArgumentName parameter.
  • postArgumentValue - The postArgumentValue is the value of the post argument sent with the page request. You may include multiple postArgumentValue parameters in one mgiIncludeHTTP tag. Each postArgumentValue parameter must have a corresponding postArgumentName parameter that is entered before the postArgumentValue parameter.
  • username - The username is the username to send with the page request if the data is protected by Basic HTTP authorization.
  • password - The password is the password to send with the page request if the data is protected by Basic HTTP authorization.


Example Usage and Output

Basic Include

<mgiIncludeHTTP url="http://www.nytimes.com" data="content">

In this example, the content from the New York Time's home page is displayed. Specific information can then be extracted using mgiString tags, for example.

Base HREF

<html>
<head>
<title>Page Title</title>
<base href="http://www.cnn.com/">
</head>
<body>
<mgiIncludeHTTP url="http://www.cnn.com" data="content">
</body>
</html>

When you include the content of a page that is not located in the same directory as the page containing the mgiIncludeHTTP tag, any elements of the page with relative file references (e.g., images) will likely break. To "fix" those elements, include the base HTML tag in the head of your page. In the href parameter of the base tag, list the URL to pre-pend to the relative file references in the page. In this example, CNN's home page elements with a relative file reference are corrected with the base tag.


Suggested Usage

  • Including Files Located Outside the Server


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]