Solved

data feed errors

Posted on 2013-05-21
14
263 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP strings vs array errors 13 33
Why is my wamp get_include_path() wrong? 2 21
Split wordpress loop 35 56
php56-php-mcrypt for rhel7 php56 1 55
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

830 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