Answers for "php post request without curl"

PHP
2

php curl post json

$ch = curl_init( $url );
# Setup request to send json via POST.
$payload = json_encode( array( "customer"=> $data ) );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
# Return response instead of printing.
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
# Send request.
$result = curl_exec($ch);
curl_close($ch);
Posted by: Guest on July-05-2021
0

how to read data from curl php

$data = json_decode(file_get_contents('php://input'), true);
Posted by: Guest on September-19-2019

Browse Popular Code Answers by Language