The mgiIncludeHTTP Tag

Tag Behavior

The mgiIncludeHTTP tag includes the headers and/or content of any web page. When the mgiIncludeHTTP tag is parsed, an HTTP request is made for the specified URL and the headers or content of the page that is returned are displayed at the location of the mgiIncludeHTTP tag. The web page information that is included can be further manipulated using other MGI tags such as mgiString.


Tag Syntax

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

<mgiIncludeHTTP url="Page Address" data="Headers/Content/HeadersAndContent">

Required Parameters:

  • url="Page Address" where "Page Address" is the absolute URL to the web page that you wish to include. The URL must begin with http:// and must include a specific page name (i.e., the format "http://www.domain.com/page.html" will work while "www.domain.com/page.html" and "http://www.domain.com/" will result in an error).

Optional Parameters:

  • data="Headers/Content/HeadersAndContent" where "Headers/Content/HeadersAndContent" is the type of data to display from the specified web page (see the following descriptions for each type). The default data is "Content".
    • Headers - Displays the HTTP header information for the specified web page.
    • Content - Displays the content of the specified web page (without the headers)
    • HeadersAndContent - Displays the HTTP header information and content of the specified web page.


Example Usage and Output

<mgiIncludeHTTP url="http://www.cnn.com/index.html" data="Headers">

This mgiIncludeHTTP tag includes the Headers from CNN's home page.

<mgiSet name="IncludeURL">
http://www.pageplanet.com/process.html?name=<mgiFieldContent name="Name">&
email=<mgiFieldContent name="Email">
</mgiSet>

<mgiIncludeHTTP url={mgiGet name="IncludeURL"} data="Headers">

Path arguments can be attached to the HTTP request by adding them to the URL and embedding the URL in the mgiIncludeHTTP tag. When the HTTP request is made, the path arguments can be processed by any script or code on the specified page before the page is included.


Suggested Usage

  • Site-wide file includes
  • Remote file includes


[Return to the Referencing MGI Menu]


[User Guide Main Menu] [Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]