Solved

data feed errors

Posted on 2013-05-21
14
269 Views
Last Modified: 2013-05-23
Hi all,
up until an hour or so ago my data fed page worked perfectly. Without any change to the code (or feed) the page is now throwing of errors.
A simplified version of the page can be seen here http://www.soundsair.com/orange-widget/test2.php
<?php 
ini_set('display_errors',1); 
 error_reporting(E_ALL);
 
 
/* gets the data from a URL */
function get_data($url) {
  $ch = curl_init();
  $timeout = 5;
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  $data = curl_exec($ch);
  curl_close($ch);
  return $data;
}

$GetTo = get_data('https://tflite.com/takeflitepublic/PgFunction.aspx?Func=GetToLocations');


// Departures
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://tflite.com/takeflitepublic/Pgweb.aspx?mode=arrival");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$raw_xml = curl_exec($ch);
curl_close($ch);
$arrivals_xml = new SimpleXMLElement($raw_xml);

?>
      <p>
            <?php
$cms = $arrivals_xml->flights->flight; 
echo  $cms->Banner;
?>
          </p>

    

            <div class="selectWrapper">
                 <?php
			// creates the location drop down selects
$myarray = explode("\n", $GetTo);
echo " <select name=\"From\" class=\"select\" id=\"From\" title=\"Select one\">
<option value\"Departing from\">Departing from</option>";
foreach ($myarray as  &$value) {
    echo '<option value="'.trim($value).'">'.trim($value).'</option>';
}
echo "</select>";
unset( $value );
?>
            
  
        </div>

          

    
    
    


  

Open in new window


the code for this page can be seen above. Does anyone have any clues as to why the feed has stopped working and more importantly how to fix it?
As you will see there are two feeds working on this page however neither of them work.
cheers,
N
0
Comment
Question by:Neil_Bradley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
14 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39186610
0
 
LVL 5

Author Comment

by:Neil_Bradley
ID: 39189212
Hi Dave,
its back up now however the issue still stands.
Cheers,
N
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39189236
This is what I get when I go to that location.
site problem
0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 5

Author Comment

by:Neil_Bradley
ID: 39189270
Mmm, thats not what I get.. The page shows a list is locations. Could you being denied access to this page be part of the issue?
0
 
LVL 5

Author Comment

by:Neil_Bradley
ID: 39189273
Just tried opening the page using Mozilla and I received the same error. Try it in IE or Chrome. The page should work fine.
N
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39189375
Interesting, you're right, IE and Chrome return a list of 4 names.  I copied your code and played with it.  It would not connect from IIS on this computer so I put it on my Linux hosting.  There the response was "Object moved to here." where 'here' was a link to a page called 'blocked.htm' which of course is not on my system but may be on theirs.
0
 
LVL 5

Author Comment

by:Neil_Bradley
ID: 39189404
More interesting still if I change the feed to this:
https://tflite.com/takeflitepublicgba/PgFunction.aspx?Func=GetToLocations

https://tflite.com/takeflitepublicgba/Pgweb.aspx?mode=arrival

It all works fine.
N

PS: The new feeds given above are from the same server, are structured in the same way but show different data.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39189602
So it's all working for you now?  With those URLS, I get it mostly working on my hosting with PHP 5.3 but not on my local server with PHP 5.2.
0
 
LVL 5

Author Comment

by:Neil_Bradley
ID: 39189627
Hi Dave,
the page works when I add the new urls but not with the original urls (which is what I need to accomplish).
Cheers,
Neil
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39189774
It's not a problem with your code since it works on the new URLs.  The original URLs are returning:
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="/takeflitepublic/Blocked.htm">here</a>.</h2>
</body></html>

Open in new window


For me that page says:
The Takeflite service has been notified that activity from this IP address is inconsistent with legitimate online behaviour. You have been blocked from making further requests. Please contact your airline if your believe that your activity is legitimate.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39189775
0
 
LVL 5

Author Comment

by:Neil_Bradley
ID: 39189801
Ok, will check their side and see what's what.
Cheers,
N
0
 
LVL 5

Author Closing Comment

by:Neil_Bradley
ID: 39192748
Thanks for your participation and patience with this one Dave. It turns out that the issue was not with my php but at the location of the feed. They had changed something that essentially blocked the requested into. White listing the data request solved the problem.
Cheers,
Neil
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39192807
Glad you got it fixed.  Thanks for the points.
0

Featured Post

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question