Solved

data feed errors

Posted on 2013-05-21
14
259 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 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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 and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

910 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

23 Experts available now in Live!

Get 1:1 Help Now