curl request php
$data = array( "userId" => "1" ); $headers = array( 'Content-Type: application/json' ); $url = "ip/api"; $curl = curl_init($url); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($curl); curl_close($curl); $jsonObject = json_decode($response); return $jsonObject;