when it comes to cross domain request for personal information such as user information it must be done on the back-ed for safety reasons. I'm am new to cURL but it has been pointed out to not use it for WP development so instead I am using the inbuilt WP_Http in wordpress. I just want to know is it safe to do so because this method is sending information through the front end, so is there a safer method to do so?

  • Currently, WP HTTP API uses cURL if possible; it not it uses default PHP functions for HTTP requests. WP HTTP API is server-side code, I can not imagine how HTTP sends information from the fornt end. Can you explain?
    – cybmeta
    Apr 24, 2015 at 13:27

1 Answer 1


The WP_Http class is essentially a wrapper for cURL in the same way that wpdb is essentially a wrapper for mysqli. As such, implemented properly, using cURL directly is exactly as safe as using WP_Http (since WP_Http uses cURL to make the requests).

That said, implementing cURL functions optimally isn't the easiest thing in the world to do. What makes WP_Http so useful is that it takes over a lot of the heavy lifting for you e.g. standardizing error handling, request structures, etc. It also gives you a suite of useful helper functions that make requesting specific things from cURL requests much simpler.

Ideally, if you are making a lot of cURL requests you would be writing a suite of functions yourself so that you don't have to have duplicate code everywhere, WP_Http just does it for you.

That is all just a long way of saying that WP_Http doesn't request information through the frontend. If it did then it would be doing something like an ajax call which, as you allude to, generally shouldn't (and in many browsers can't) be used for cross-domain requests.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.