I would like to know how to send a post request in curl and get the response page.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What about something like this :
For a list of options that can be used with curl, you can take a look at the page of
curl_setopt.Here, you’ll have to use, at least :
CURLOPT_POST: as you want to send a POST request, and not a GETCURLOPT_RETURNTRANSFER: depending on whether you wantcurl_execto return the result of the request, or to just output it.CURLOPT_POSTFIELDS: The data that will be posted — can be written directly as a string, like a querystring, or using an arrayAnd don’t hesitate to read the curl section of the PHP manual 😉