Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 91

SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
04/18/16 04:13 AM (8 years ago)

Not BT related, but BT related...

Summary: PHP CURL and file_get_contents will not work on a 'non-standard' port. ---------- So, I've delayed the launch of my Guam Airport app for almost a month now. I get my flight data from a raspberry pi computer on my local network, dedicated to ADS-B aircraft data reception. Flight JSON data, the kind that powers my custom plugin (basically a map substituting little airplanes for map pins), is available using the dump1090 webserver URL on port 8080 which I mapped to port 81 on my Internet router (port 80 being used by another box). So if I pointed a browser at my external IP at port 81, I got flight json data. I developed my plugin. Everything is working great. I build the app. I'm minutes from release, and then it dawns on me... If this app even becomes remotely famous or well known and well used, both "my" internet experience as well as the user app experience could be jeopardized by the sheer volume of potential traffic trying to get flight data from my home network. So I've been trying to figure out a way to get the flight data from my raspberry pi box to my hostgator server, that would be able to handle the traffic. Normally you would think this is simple, and in the end, it was. Build a php script that grabs the json data, saves it to a local file on the hostgator server. do this once per second. But I couldn't get it to work for almost an entire month. It was killing me. Both CURL and file_get_contents was giving me 'connection refused' issues. Yet on almost any other kind of browser I got data. I had friends from all over the planet check, and they got data too. I use these same methods on other servers, and have no problems at all. If I had hair, I'd have been tearing it out. Without going into a lot of it, and it's possible this is all due to my lack of knowledge, but at this time I believe that PHP CURL and file_get_contents will not work on a 'non-standard' port. I had the server mapped to port 81 of my home router. Recently, I retired the box that used port 80, and so I re-mapped the port to my Raspberry Pi box and holy cow, it started working. So, in the end, it works, and I'm wrapping up iTunes art and stuff for release. My script works a treat, now that I have the source side available and working. And for those folks who are better at php than I, the problem was the url being "xxx.xxx.xxx.xxx:81/data.json". Maybe I need to format ":81" differently? I don't know... All I know is it works now using "xxx.xxx.xxx.xxx/data.json" without the non-standard port. Sorry to take so long to explain it, but I felt the need to vent a little ;) Cheers! -- Smug
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
04/18/16 05:16 AM (8 years ago)
nice work Smug! Looking forward to seeing your App in action, so dont forget to tell us when its live!
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
04/18/16 12:01 PM (8 years ago)
Good work.
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
04/20/16 01:56 PM (8 years ago)
It's our assumptions that kill us ... and delight us :-) -- Niraj
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.