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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:41:53+00:00 2026-06-13T13:41:53+00:00

I am having some trouble displaying XML values stored in my arrays. I successfully

  • 0

I am having some trouble displaying XML values stored in my arrays. I successfully traversed the nodes, but I’m trying to echo the arrays all together.
Here is my code:

<?php  
$other_feed_url = "http://xml.pinnaclesports.com/pinnaclefeed.aspx?sporttype=Football&sportsubtype=NFL";  
$xml2 = simplexml_load_file($other_feed_url);  
$AwayLine[] = (string)$xml2->spread_visiting;  
$HomeLine[] = (string)$xml2->home_visiting;  
$AwayMoneyLine[] = (string)$xml2->moneyline_visiting;  
$HomeMoneyLine[] = (string)$xml2->moneyline_home;  
$AwaySpreadAdjust[] = (string)$xml2->spread_adjust_visiting;  
$HomeSpreadAdjust[] = (string)$xml2->spread_adjust_home;  
$UnderAdjust[] = (string)$xml2->under_adjust;  
$OverAdjust[] = (string)$xml2->over_adjust;  
$TotalPoints[] = (string)$xml2->total_points;  
for($i=0;$i<20; $i++) {  
    foreach ($xml2->events->event as $event) {  
        $Spread = $event->periods->period[0]->spread;   
        $MoneyLine = $event->periods->period[0]->moneyline;  
        $TotalPoints = $event->periods->period[0]->total;      
        $AwayLine[] = $Spread->spread_visiting;   
        $HomeLine[] = $Spread->spread_home;  
        $AwayMoneyLine[] = $MoneyLine->moneyline_visiting;   
        $HomeMoneyLine[] = $MoneyLine->moneyline_home;  
        $UnderAdjust[] = $TotalPoints->under_adjust;   
        $OverAdjust[] = $TotalPoints->over_adjust;  
        $TotalPoints[] = $TotalPoints->total_points;  
    }  
    echo '<br>';  
    echo $AwayLine[$i];  
    echo '<br>';  
    echo $HomeLine[$i];  
    echo '<br>';  
    echo $AwayMoneyLine[$i];   
    echo '<br>';  
    echo $HomeMoneyLine[$i];  
    echo '<br>';  
    echo $TotalPoints[$i];  
}  
?>
  • 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-06-13T13:41:55+00:00Added an answer on June 13, 2026 at 1:41 pm

    You are setting $MoneyLine = $event->periods->period[0]->moneyline; but this does not exist in the XML document you are loading. When you then try to fetch $AwayMoneyLine[] = $MoneyLine->moneyline_visiting;, there is no resulting value. See below for an example of one of the XML nodes from the document you are parsing:

    <event>
        <event_datetimeGMT>2012-11-02 00:25</event_datetimeGMT>
        <gamenumber>272519903</gamenumber>
        <sporttype>Football</sporttype>
        <league>NFL</league>
        <IsLive>No</IsLive>
        <participants>
            <participant>
                <participant_name>Kansas City Chiefs</participant_name>
                <contestantnum>301</contestantnum>
                <rotnum>301</rotnum>
                <visiting_home_draw>Visiting</visiting_home_draw>
            </participant>
            <participant>
                <participant_name>San Diego Chargers</participant_name>
                <contestantnum>302</contestantnum>
                <rotnum>302</rotnum>
                <visiting_home_draw>Home</visiting_home_draw>
            </participant>
        </participants>
        <periods>
            <period>
                <period_number>0</period_number>
                <period_description>Game</period_description>
                <periodcutoff_datetimeGMT>2012-11-02 00:25</periodcutoff_datetimeGMT>
                <period_status>I</period_status>
                <period_update>open</period_update>
                <spread_maximum>10000</spread_maximum>
                <moneyline_maximum>5000</moneyline_maximum>
                <total_maximum>3000</total_maximum>
                <spread>
                    <spread_visiting>9.5</spread_visiting>
                    <spread_adjust_visiting>-130</spread_adjust_visiting>
                    <spread_home>-9.5</spread_home>
                    <spread_adjust_home>120</spread_adjust_home>
                </spread>
                <total>
                    <total_points>42.5</total_points>
                    <over_adjust>-102</over_adjust>
                    <under_adjust>-108</under_adjust>
                </total>
            </period>
        </periods>
    </event>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to scrape some information from a web site, but am having trouble
I'm having some trouble with displaying numbers in apex, but only when i fill
I am having some trouble displaying a div on click using JQuery. All the
My Java application is displaying some odd behaviour, and I'm having trouble finding a
I'm having some trouble displaying the time in this format: HH:mm:ss. No matter what
I'm having trouble displaying SOME images on my android app. Just normal display image
I having trouble getting append() to work in safari for some reason, but it
I'm having some trouble with displaying a popup div with CSS. The problem is
I'm writing a news-app and I'm having some trouble with displaying a custom list.
I'm having some trouble getting my Table and Colspans to work. I'm trying to

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.