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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:11:34+00:00 2026-05-24T14:11:34+00:00

Ok so first let me explain what I am doing: I am trying to

  • 0

Ok so first let me explain what I am doing:

I am trying to connect to http://www.nfl.com/liveupdate/scorestrip/ss.xml to grab the xml and parse it of course cross domain policy wont allow me to do this directly. SOOOO..

I am using PHP to connect to the site through a proxy and this works perfectly

Then back in my main HTML file I am using Ajax to parse through that XML file. Problem is I am getting mixed results. For instance on my macbook pro with all the latest browsers (Safari, Firefox, Chrome) this doesn’t work. On my iPhone it works. and on my Mac Desktop with all latest browsers it works.

Anyone know why?

ALSO I have no clue what I am doing with XML this is my very first attempt to learn how to read through XML. SO I may need you to explain how to better parse though as the way I am doing it now is from a fellow online user.

Here is the PHP proxy which works:

<?php

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

$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}".$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}".$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]; 


?> 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

Here is the troublesome HTML file with AJAX:

<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>

<script>

$.ajax({
    type: "GET",
    url: "http://www.allencoded.com/test3.php",
    dataType: "xml",
    success: function(xml) {
        // Interpret response
        $(xml).find('g').each(function() {

            // Example: Show the XML tag in the console
            console.log(this);

            // Example: Put some output in the DOM
            $("#divOutput").append($(this).attr("hnn"));

        });

        $(xml).find('g').each(function() {



            // Example: Put some output in the DOM
            $("#divOutput").append($(this).attr("vnn"));

        });        

    }
});
</script>

<div id="divOutput"></div>

</body></html>

Finally here is XML for reference:
http://www.nfl.com/liveupdate/scorestrip/ss.xml

I am really looking for a way to parse this as it will be an awesome learning experience. BTW if it helps Firefox on my macbook with all the problems is telling me: missing ) in parenthetical line 12

Also I would greatly appreciate it if you were so kind to answer in terms a noobie may understand for dealing with XML as I am new to it.

Thanks!

Edit:
Adding my website links to this code:
http://allencoded.com/footballxml.html
and
http://allencoded.com/test3.php

  • 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-24T14:11:35+00:00Added an answer on May 24, 2026 at 2:11 pm

    If it’s not caused by some C&P issue, this could be the cause:

    $(xml).find('g').each(function() {
    
    
    
            // Example: Put some output in the DOM
            $("#divOutput").append($(this).attr("vnn"));
    
    }) //Here is a colon missing!
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, let me explain what I am doing. I need to take an order,
Let me first try to explain what I'm trying to achieve. I'm making a
First let me explain my goal. I am trying to make an Animation that
Alright let me explain my situation first: I am part of an organization that
This question might not seem programming related at first, but let me explain. I'm
let me try to explain my problem. I'm currently trying to develop a small
First let me explain the data flow I need Client connects and registers with
First, let me explain a little bit about my setup. My server is setup
First let me explain that I am on a hosted solution, and there is
First let me explain that I am on a hosted solution, and there 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.