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 6330253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:50:15+00:00 2026-05-24T17:50:15+00:00

Following on from this question I am using the code provided in one of

  • 0

Following on from this question I am using the code provided in one of the answers.

Here is the 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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>



<?php

$server_url = "http://www.nfl.com/liveupdate/scorestrip/ss.json";

$options = array
(
    CURLOPT_HEADER         => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_TIMEOUT        => 60,
    CURLOPT_CONNECTTIMEOUT => 0,
    CURLOPT_HTTPGET        => 1
);

$service = $_GET["service"];

$request_headers = Array();
foreach($_SERVER as $i=>$val) {
        if (strpos($i, 'HTTP_') === 0) {
                $name = str_replace(array('HTTP_', '_'), array('', '-'), $i);
                if ($name != 'HOST')
                {
                    $request_headers[] = "{$name}: {$val}";
                }
        }
}

$options[CURLOPT_HTTPHEADER] = $request_headers;

switch (strtolower($_SERVER["REQUEST_METHOD"]))
{

    case "post":
        $options[CURLOPT_POST] = true;
        $url = "{$server_url}/services/".$service;

        $options[CURLOPT_POSTFIELDS] = file_get_contents("php://input");

        break;
    case "get":

        unset($_GET["service"]);

        $querystring = "";
        $first = true;
        foreach ($_GET as $key => $val)
        {
            if (!$first) $querystring .= "&";
            $querystring .= $key."=".$val;
            $first = false;
        }

        $url = "{$server_url}/services/".$service."?".$querystring;

        break;
    default:
        throw new Exception("Unsupported request method.");
        break;

}

$options[CURLOPT_URL] = $url;

$curl_handle = curl_init();

curl_setopt_array($curl_handle,$options);
$server_output = curl_exec($curl_handle);
curl_close($curl_handle);

$response = explode("\r\n\r\n",$server_output);
$headers = explode("\r\n",$response[0]);

foreach ($headers as $header)
{
    if ( !preg_match(';^transfer-encoding:;ui', Trim($header))  )
    {
        header($header);
    }
}

echo $response[1]; 


?> 



</body>
</html>

Unfortunately I get the following errors, why is this?:

Warning: Cannot modify header information – headers already sent by
(output started at
C:\inetpub\vhosts\allencoded.com\httpdocs\test.php:12) in
C:\inetpub\vhosts\allencoded.com\httpdocs\test.php on line 88 Warning:
Cannot modify header information – headers already sent by (output
started at C:\inetpub\vhosts\allencoded.com\httpdocs\test.php:12) in
C:\inetpub\vhosts\allencoded.com\httpdocs\test.php on line 88 Warning:
Cannot modify header information – headers already sent by (output
started at C:\inetpub\vhosts\allencoded.com\httpdocs\test.php:12) in
C:\inetpub\vhosts\allencoded.com\httpdocs\test.php on line 88 Warning:
Cannot modify header information – headers already sent by (output
started at C:\inetpub\vhosts\allencoded.com\httpdocs\test.php:12) in
C:\inetpub\vhosts\allencoded.com\httpdocs\test.php on line 88 Warning:
Cannot modify header information – headers already sent by (output
started at C:\inetpub\vhosts\allencoded.com\httpdocs\test.php:12) in
C:\inetpub\vhosts\allencoded.com\httpdocs\test.php on line 88 Warning:
Cannot modify header information – headers already sent by (output
started at C:\inetpub\vhosts\allencoded.com\httpdocs\test.php:12) in
C:\inetpub\vhosts\allencoded.com\httpdocs\test.php on line 88 Warning:
Cannot modify header information – headers already sent by (output
started at C:\inetpub\vhosts\allencoded.com\httpdocs\test.php:12) in
C:\inetpub\vhosts\allencoded.com\httpdocs\test.php on line 88 Warning:
Cannot modify header information – headers already sent by (output
started at C:\inetpub\vhosts\allencoded.com\httpdocs\test.php:12) in
C:\inetpub\vhosts\allencoded.com\httpdocs\test.php on line 88 Warning:
Cannot modify header information – headers already sent by (output
started at C:\inetpub\vhosts\allencoded.com\httpdocs\test.php:12) in
C:\inetpub\vhosts\allencoded.com\httpdocs\test.php on line 88 HTTP/1.1
404 Not Found Server: Apache Content-Type: text/html;
charset=iso-8859-1 Content-Encoding: gzip Content-Length: 224
Cache-Control: max-age=7146 Expires: Sat, 13 Aug 2011 22:12:11 GMT
Date: Sat, 13 Aug 2011 20:13:05 GMT Connection: keep-alive Vary:
Accept-Encoding X-Akamai-Edgescape: country_code=US

  • 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-24T17:50:17+00:00Added an answer on May 24, 2026 at 5:50 pm

    You cannot echo anything out before calling header so in your case its all of the stuff before your opening php tags.

    Your best bet would be to do all of your php before your opening html tag

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following on from this question I now have code that can attach to a
Following on from this question, I find myself writing the following code over and
Following on from this question what would be the best way to write a
Following up from this question: How can I unlock a file that is locked
Following on from this question , I now want to know how to stop
Following on from this question, what would be the best way to represent a
Following on from this question: Run WCF ServiceHost with multiple contracts Are there any
Following on from this question , I am interested in finding out how you
following on from this question (Developing to an interface with TDD), I'm still having
Following on from this question...I'm trying to unit test the following scenario: I have

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.