I'm new to curl. Just I try to post the value using curl script but I'm getting empty response. Help me is there any mistake in my code? How do I post a value using curl
$params = array('name' => 'karthick', 'type' => 'data'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://example.com/test.php?action=create'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt($ch, CURLOPT_POST, true ); // curl_setopt($ch, CURLOPT_USERPWD,$authentication); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); // curl_setopt($ch, CURLOPT_REFERER,'http://www.example.com.au'); curl_setopt($ch, CURLOPT_POSTFIELDS,$params); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); $result = curl_exec($ch); curl_close($ch); var_dump($result);