3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php //build data parameters $data = array( 'name' => 'foo', 'phone_no' => '39327774645', 'password' => 'kdjfkff' ); //request header $headers = array( "Accept: application/json", "X-HTTP-Method-Override: POST" ); //CURL initialization with URL, Method, Header and Parameters $url = "https://194.244.57.4/api_friends/v1/register"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); //SEND request $response = curl_exec($curl); //read the result $json = json_decode($response, true); //print different array element echo "ERROR: " . $json['error'] ."\n"; // true o false echo "MSG: " . $json['message'] ."\n"; // Operation completed! echo "STATUS: " .$json['status'] ."\n"; // 200 //print all array echo print_r ($json); //other optional actions if ($json['status'] == '200') { echo "OK"; //... } else { echo "FAILED"; //... } ?>
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/EMIoi:19 Stack trace: #0 {main} thrown in /in/EMIoi on line 19
Process exited with code 255.
Output for 5.0.0 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/EMIoi on line 19
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: curl_init() in /in/EMIoi on line 19
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: curl_init() in /in/EMIoi on line 19
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: curl_init() in /in/EMIoi on line 19