3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php define("ZDAPIKEY", "0TDALUGakEn6oJ23ZaeQnLmjqtqwnLxz6pXnZrxT"); define("ZDUSER", "msirianni@zendesk.com"); define("ZDURL", "tckts"); function curlWrap($url, $json) { $ch = curl_init(); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true ); curl_setopt($ch, CURLOPT_MAXREDIRS, 10 ); curl_setopt($ch, CURLOPT_URL, ZDURL.$url); curl_setopt($ch, CURLOPT_USERPWD, ZDUSER."/token:".ZDAPIKEY); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json')); curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $output = curl_exec($ch); curl_close($ch); $decoded = json_decode($output); return $decoded; } foreach($_POST as $key => $value){ if(preg_match('/^z_/i',$key)){ $arr[strip_tags($key)] = strip_tags($value); } } $create = json_encode(array( 'ticket' => array( 'subject' => 'New Order', 'external_id' => 180, 'type' => 'task', 'group_id' => 66729, 'collaborator_ids' => array( 24178883 ), 'requester' => array( 'locale_id' => 1, 'name' => 'Test Name', 'email' => 'test@test.com', ), 'comment' => array( 'public' => true, 'body' => "\nThank you for your order.\n\nBelow is a breakdown for you to check and confirm back that everything is exactly as you want.\n\nOnce you are happy we will update this ticket with a Go Live certificate so you know your services are live and you will be billed from this point.\n\n\nYour details:\n\nCustomer: Connect B2B Ltd\nCustomer site: Lucy's Office\nCustomer contact: Lucy Robinson lr@connectb2b.co.uk\nDelivery method: Pre 12 £15.00\nDelivery address: Connect B2B Ltd\r\n12 Melcombe Place\r\nLondon\r\nNW1 6JJ\r\nLondon \r\nNW1 6JJ\nOrder date: 06/06/14\n\nOrder details:\n\nHorizon Cisco SPA 122 VoIP Analogue Phone Adapter £50.00 x 1 12345678901 12 months", ), ) )); $return = curlWrap("/tickets.json", $create); ?>
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/cFBNX:8 Stack trace: #0 /in/cFBNX(49): curlWrap('/tickets.json', '{"ticket":{"sub...') #1 {main} thrown in /in/cFBNX on line 8
Process exited with code 255.
Output for 5.2.0 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/cFBNX on line 8
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/cFBNX on line 29
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_encode() in /in/cFBNX on line 29
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: json_encode() in /in/cFBNX on line 29
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_encode() in /in/cFBNX on line 29