Solved

data feed errors

Posted on 2013-05-21
14
255 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
  • 7
  • 7
14 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
0
 
LVL 5

Author Comment

by:Neil_Bradley
Comment Utility
Hi Dave,
its back up now however the issue still stands.
Cheers,
N
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
This is what I get when I go to that location.
site problem
0
 
LVL 5

Author Comment

by:Neil_Bradley
Comment Utility
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
Comment Utility
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 82

Expert Comment

by:Dave Baldwin
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
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
Comment Utility
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 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
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 82

Expert Comment

by:Dave Baldwin
Comment Utility
0
 
LVL 5

Author Comment

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

Author Closing Comment

by:Neil_Bradley
Comment Utility
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 82

Expert Comment

by:Dave Baldwin
Comment Utility
Glad you got it fixed.  Thanks for the points.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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 look for a specific file type in a local or remote server directory using PHP.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now