Are there built-in php functions that allow me to make post and get HTTP requests? All the functions I've found are extensions why wouldn't php have some of these basic functions built-in?
Are my only options extensions?
Built-in HTTP request php functions.
Moderator: General Moderators
Re: Built-in HTTP request php functions.
With file_get_contents("http://some.random.url/whatever?param=bla") you can get the contents of a remote page, which invokes a normal GET request.
Similarly, file will get the data as an array, and readfile will output the downloaded content directly to your script's own output.
Unfortunately, there is not an easy alternative to do POST requests. You'll have to mess around with fsockopen, or use or something like cURL (the latter is actually quite nice to work with, and also takes care of secure https connections).
Similarly, file will get the data as an array, and readfile will output the downloaded content directly to your script's own output.
Unfortunately, there is not an easy alternative to do POST requests. You'll have to mess around with fsockopen, or use or something like cURL (the latter is actually quite nice to work with, and also takes care of secure https connections).