We have several devices in the "field" that upload data to our FTP server and we ingest the data from there. We are looking to try more of an "API" route and have our embedded C and linux devices use HTTPS posts to send the data up.

Then have our devices send data via json? xml? ??

and have a PHP script ingest the data into our database.

So connect to

Send :
Field Unit Type: X1
Data1: 100
Data2: 5

So my question is, are we walking down the right path for a secure way to upload to our servers. Second, any example code or preference between json or xml?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
POST uses name/value pairs to send data to a server.  Typically it looks like this and PHP will decode it as separate named $_POST values.

Open in new window

PHP using curl will work on the Linux machines but I don't know what you need in C.  You will probably need to connect to the OpenSSL library to make and support the HTTPS connection.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
What is the true URL of this API?  The posted URL does not work.
-TNT-Author Commented:
Thanks, this is is direction we have been headed. I just wanted to hear somebody else say it. Would you run the ingest script as a CGI?
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

-TNT-Author Commented:
Hahaha... doesn't work???? hahha

Read the post, we have no API, working on it now.
Dave BaldwinFixer of ProblemsCommented:
No, the 'ingest' script would just be a PHP page, it doesn't 'require' a CGI directory like you would use with Perl.  It would run with the interface used by the web server.  The older interface was called ISAPI but most sites use FastCGI these days.  However, it's not something that you have to be concerned about unless you are setting up PHP yourself.  Even then, it's just a choice between ISAPI and FastCGI.  On this computer with PHP 5.3.28, all I see is 'php-cgi.exe' and no 'php5isapi.dll'.
Ray PaseurCommented:
Hahaha... doesn't work???? hahha
That's right.  If you want to get help at EE (or in any other forum) posting a bogus URL is a non-starter, and you would be amazed how often people do this.  Please take a moment to learn about the SSCCE, and use that strategy in formulating your questions.  If you don't have an API yet, just write a simple script that bounces the request variables back to the requesting client.

On the question of XML vs JSON, choose JSON.  It's got a better payload-to-propellant ratio and it's easily consumed by many programming languages.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.