I need to pass some POST data to a url and then retreive the data returned by that url. Obviously this is easily accomplished by using an html form and http post but it would be a lot more convenient for me to do this in the background from within a function with the returned data stored in a variable. I’m fairly certain this is possible with php but just need some advice on which method to use.
I’ve tried several cUrl examples but this doesn’t appear to work for some reason. Perhaps the Url I’m posting to does not allow cUrl submissions.
I’ve decided it would simpler to make a form on a new html page which submits automatically when loaded. Is it possible to load this page in the background and return the output as a string. I’ve tried using file_get_contents($url) but this doesn’t seem to work.
Or take a look at cURL
Googling for ‘curl post data’ gives a lot of manuals and code examples.
Sounds like AJAX is what you need.