3v4l.org

run code in 300+ PHP versions simultaneously
<?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 git.master, git.master_jit, rfc.property-hooks
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.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
30.77 ms | 401 KiB | 8 Q