Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
Why does fetching a .php file using post return a blank result

Okay, running this in a Node.JS enviornment (using node-fetch) works just fine, it returns the expected result.

fetch(`<URL>/api.php?f=developmentIsAnnoying2`,{method:"post",body:JSON.stringify({time:0,queue:["a song"],
repeat:false,loop:false})}).then(d=>d.text()).then(console.log);

But running the same code in Google Chrome, using the same domain, returns an absolutely blank result. There are no errors, on any side (client, php, nor API).

PHP:

    header("Content-Type: application/json");
    switch($_SERVER['REQUEST_METHOD']) {
        case "POST":
            echo file_get_contents('php://input');
        break;
        default:
            echo '{"message":"This is a place holder."}';
        break;
    }

What's the deal!?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

My last answer was removed by a moderator, so here's the answer again;

For some reason, it gets mad about the JSON header, despite the fact all data is ALWAYS supposed to be JSON, and was used that way in testing.

So, I had to remove this part:

header("Content-Type: application/json");
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!