Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6235015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:35:51+00:00 2026-05-24T10:35:51+00:00

I am trying to make a page that returns a file if the page

  • 0

I am trying to make a page that returns a file if the page is being requested by a user, and returns a api response if requested by code. It works fine but google chrome (and ie) render the user page as if it was:

<head></head>
<body><title>BLAH</title>
<h1>Bloo bloo blah</h1></body>

Even though view source returns:

<head><title>BLAH</title></head>
<body><h1>Bloo bloo blah</h1></body>

but when I go to the page that is being included, it displays improperly.

PHP code:

<?php
if ($_GET['mode']) {
    echo 'server response';
}
else {
    include_once('main.php');
}
?>

main.php code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>BLAH</title></head>
<body><h1>Bloo bloo blah</h1></body> 
</html>

Any help would be appreciated.
I am using IIS 6.1 with PHP 5.3.5 running on a Windows 7 computer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:35:52+00:00Added an answer on May 24, 2026 at 10:35 am

    Please try the following:

    Instead of

    if ($_GET['mode']) {
    

    check if a value for the key mode is set before using it:

    if (isset($_GET['mode']) && $_GET['mode']) {
    

    That’s just a precaution in case PHP generates output because of a warning or notice (but must not), which can influence the output then.

    Next to that you should actually check what the server is returning, not what view source in the browser gives you. Install the cUrl commandline tool (Download) and then run in a shell:

    curl http://myurl
    

    It will output the HTML as your server returns it. This information is actually needed before your problem can be further analyzed.

    Edit: The cause of your problem is that main.php is saved with a BOM. Remove the BOM from the file and you’re fine.

    Related:

    • UTF-8 BOM signature in PHP files
    • Validation error: Byte-Order Mark found in UTF-8 File
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm trying to make a registration page that feeds back a variable when
I have a page that I am trying to make a generic style of
I'm trying to make a web scraper that will parse a web-page of publications
Short question: I'm trying to make that in a given page (uses tabs) back
I'm trying to make a WordPress site that has six lists on a page,
Here is jsfiddle ! I am trying to make user page where he can
trying to make a page which will recursively call a function until a limit
I'm trying to make a page with some Points in it. E.g: Point1 Point2
I am trying to make a page where users can add as many rows
I'm trying to make a login page using html, ajax & ASP.NET.The data is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.