The basic function of curl post request is first you initialize a session using the curl_init() function ans then set all option for transfer through curt_setopt() function then and the execute your session with curl_exec() function and after all finish your request usingcurl_close() function.
A Simple Curl Post Http request
<?php // initialize session $ch = curl_init(); //url using for request curl_setopt($ch, CURLOPT_URL,"http://www.example.com"); //request mehod curl_setopt($ch, CURLOPT_POST, 1); //number of field want to curl_setopt($ch, CURLOPT_POSTFIELDS,"postvar1=value1&postvar2=value2&postvar3=value3"); //for receive response of server curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // session executed and hold response in $server_response variable $server_response = curl_exec ($ch); ?>
Hello, My Name is pradip parker . I am a Web Developer, Professional Blogger from India. i love and like web designing and developing, i have two year of experience in programming and developing I am the founder of programmingconcept. I started this blog in 2017 to for help developers by providing easy,small and best tutorials.