Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

data feed errors

Posted on 2013-05-21
14
Medium Priority
?
274 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 84

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 84

Expert Comment

by:Dave Baldwin
ID: 39189236
This is what I get when I go to that location.
site problem
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 84

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 84

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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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 84

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 84

Expert Comment

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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 …
Suggested Courses

885 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