I'm trying to write a simple script where someone can post to a URL via CURL or any other language and post a password string and it returns JSON data

I'm testing via this site and I'm getting the below error. What can I do

https://resttesttest.com/

Oh no! Javascript returned an HTTP 0 error. One common reason this might happen is that you requested a cross-domain resource from a server that did not include the appropriate CORS headers in the response. Better open up your Firebug...

I have this on my page

header('Access-Control-Allow-Origin: https://resttesttest.com//'); 
header('Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE'); 
header('Access-Control-Allow-Headers: Content-Type, x-requested-with'); 
header('Access-Control-Max-Age: 86400'); 
header('Content-type: application/json');

    I want to say that if I requested your page via cURL that none of those headers will make any difference at all. I'd also say that if you are requesting your page via AJAX/XHR, that it would fail if the JS was hosted from any site other than https://resttesttest.com -- if the protocol was HTTP instead of HTTPS, it would fail; if your browser was pointed at www.resttesttest.com it would fail; if your browser was pointed at some other port, it would fail.

    You've left out a lot of detail here, so it's hard to assess what the problem might be.

      Write a Reply...