PHP Curl POST with JSON returns Server Error 500 - Django -
i using code below make php curl post request. tell me , why server sends me server error code 500? when open api link in browser , test json data ok. use similar code make put request , don`t have problems.
$postarray = array( "email" => $email ); $json = json_encode( $postarray, json_pretty_print ); $pl4m_url = "api-link"; $ch = curl_init($pl4m_url); curl_setopt($ch, curlopt_customrequest, "post"); curl_setopt($ch, curlopt_httpheader, array('content-type: application/json')); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_postfields,$json); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_followlocation, 1); $result = curl_exec($ch); curl_close($ch); echo $result;
Comments
Post a Comment