phpMake a POST request with curl
$c = curl_init( 'https://example.com/' );
curl_setopt_array($c, [
  CURLOPT_RETURNTRANSFER => 1,
  CURLOPT_POST => 1,
  CURLOPT_POSTFIELDS => http_build_query(['a' => 1, 'b' => 2])
]);
echo curl_exec($c);ctrl + c| curl_init(create curl handler for specified URL | curl_setopt_array(configures curl | 
| CURLOPT_RETURNTRANSFERwill return response to variable rather than print | CURLOPT_POSTset method type to POST | 
| CURLOPT_POSTFIELDSpost request body | http_build_querybuild post body from specified array of variables and values | 
| curl_exec(executes GET request to a specified URL | |
More of Php
- Enable errors display
- Disable notices ("Undefined variable", “Undefined index”, "Undefined offset”...)
- Convert standard numbers to Persian numbers
- Remove a directory that is not empty
- Replace or add query parameter to the current url
- Request a URL with curl
- Check if string contains specific substring
- Delete an element from array by value
- Make 302 (Moved Temporarily) redirect
- Find the position of a letter in the alphabet
See more codes...