1

i'm currently trying to get a local html file to talk to a php script on my server. Here is what i want to achieve:

i use a desktop application to generate html reports containing test data. these reports are saved into a certain folder on the local disk. The only thing i have control over in this process, is the template for the reports i can edit. I added a button in the template which is supposed to fire a post to the server side php which parses the file and pushes the data into my database.

One requirement is that many testclients on different machines send the data to one centralized server which writes into one centralized database.

Of course i'm running into the cross-domain restrictions for ajax requests and i tried to solve this by using jsonp. However as i understand it, this technology is mainly meant to GET data from external servers, i need to POST the data from the local htmlfile to my server.

Does anyone have an idea on how this can be done? any hints are highly appreciated!!thanks alot!

1 Answer 1

1

Here's a few things you can try:

  1. Look into CORS, although it probably won't work well with older browsers. Here's a tutorial: http://www.nczonline.net/blog/2010/05/25/cross-domain-ajax-with-cross-origin-resource-sharing/
  2. Create a connection to the database in your desktop application. Instead of firing a post to the server side php, parse and save it into the DB right then and there.
  3. If you can use JavaScript, look into easyXDM. If you're using HTML5 as well, look into postMessage().
Sign up to request clarification or add additional context in comments.

4 Comments

Thank you for your answer, i will happily try your suggestions right away. I'm aware, that what i'm trying to do is a workaround. However, the desktop application we use is not open source and not an in house development, so i can't directly integrate the database connection. The requrirements are, that all i can modify, is the template for the reports and that the clients running the tests need no further additional configuration...
ok, i tried all of it...easyXDM tells me it does not support the file protocol...this is getting way harder than i expected it to be...
Cross-domain transactions are extremely dangerous; the difficulty in getting around it is by design. Although my suggestions should'v worked if you had more access to the systems, it seems like there's not much you we can do here.
Thank you for your support! I'm trying now to use javascript to upload the file via ftp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.