Splunk API works on Postman but not on PHP

I have a CakePHP application where I'm calling Splunk API to make a search and obtain its results. It works as a charm when I try it on Postman, but when run by my server it doesn't return results every time. In fact, when I call the API constantly inside a while loop, it does tend to bring results, although sometimes it could take more 2 minutes to return something.