3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php define('REST_URL', 'https://api.nizex.com/submitorder'); //Defines the url and function to be called. define('API_KEY', 'my-api-key'); //API Key from Lizzy $orders = array("Orders" => array(0 => array( "OrderNumber" => "825713", //Order number from the web store "Date" => "2013-02-12", //Date the order was created "Time" => "15:28", //Time the order was created "InvoiceNumber" => "", //Invoice number from the web store, "" if not applicable "Tax" => 1.99, //Tax amount (Format 0.00) "ShippingCost" => 5.99, //Shipping cost (Format 0.00) "Total" => 28.83, //Total cost of the order (Format 0.00) "PaymentMethod" => "Visa", //Payment method used by customer. "ShippingAddress" => array( "FirstName" => "Noel", //Ship to first name "LastName" => "Jacques", //Ship to last name "EmailAddress" => "njacques@nizex.com", //Ship to email address "CompanyName" => "Nizex Inc.", //Ship to company name "Phone" => "6783594184", //Ship to phone number "Address" => "1735 Pennsylvania Ave.", //Ship to address "Address2" => "", //Ship to address 2 "City" => "McDonough", //Ship to city "State" => "GA", //Ship to state (two letter abbreviation only) "ZipCode" => "30353", //Ship to zip code "Country" => "US", //Ship to county (two letter abbreviation only) "Method" => "Priority Mail" //Shipping method (ex. FedEx Next Day, etc...) ), "BillingAddress" => array( "FirstName" => "Noel", //Bill to first name "LastName" => "Jacques", //Bill to last name "EmailAddress" => "njacques@nizex.com", //Bill to email address "CompanyName" => "Nizex Inc.", //Bill to company name "Phone" => "6783594184", //Bill to phone number "Address" => "1735 Pennsylvania Ave.", //Bill to address "Address2" => "", //Bill to address 2 "City" => "McDonough", //Bill to city "State" => "GA", //Bill to state (two letter abbreviation only) "ZipCode" => "30353", //Bill to zip code "Country" => "US", //Bill to county (two letter abbreviation only) ), "OrderItems" => array( 0 => array( "ProductID" => "01-0013", //Product part number "ProductCode" => "PUN", //Product brand code "ProductDesc" => "Oil Filter, Kawasaki", //Product description "Price" => "6.95", //Price presented to customer (Format 0.00) "Quantity" => "2", //Quantity ordered "DropShip" => "True" //Flag item as a drop ship item. ), 1 => array( "ProductID" => "01-0021", //Product part number "ProductCode" => "PUN", //Product brand code "ProductDesc" => "Oil Filter, Honda", //Product description "Price" => "6.95", //Price presented to customer (Format 0.00) "Quantity" => "1" //Quantity ordered ))))); $orders = json_encode($orders); //Setup the curl request $qrystr = "&APIKey=".API_KEY."&Payload=$orders"; echo $qrystr;
Output for 5.2.0 - 7.1.0
&APIKey=my-api-key&Payload={"Orders":[{"OrderNumber":"825713","Date":"2013-02-12","Time":"15:28","InvoiceNumber":"","Tax":1.99,"ShippingCost":5.99,"Total":28.83,"PaymentMethod":"Visa","ShippingAddress":{"FirstName":"Noel","LastName":"Jacques","EmailAddress":"njacques@nizex.com","CompanyName":"Nizex Inc.","Phone":"6783594184","Address":"1735 Pennsylvania Ave.","Address2":"","City":"McDonough","State":"GA","ZipCode":"30353","Country":"US","Method":"Priority Mail"},"BillingAddress":{"FirstName":"Noel","LastName":"Jacques","EmailAddress":"njacques@nizex.com","CompanyName":"Nizex Inc.","Phone":"6783594184","Address":"1735 Pennsylvania Ave.","Address2":"","City":"McDonough","State":"GA","ZipCode":"30353","Country":"US"},"OrderItems":[{"ProductID":"01-0013","ProductCode":"PUN","ProductDesc":"Oil Filter, Kawasaki","Price":"6.95","Quantity":"2","DropShip":"True"},{"ProductID":"01-0021","ProductCode":"PUN","ProductDesc":"Oil Filter, Honda","Price":"6.95","Quantity":"1"}]}]}
Output for 5.0.0 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/v9fqR on line 58
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_encode() in /in/v9fqR on line 58
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: json_encode() in /in/v9fqR on line 58
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_encode() in /in/v9fqR on line 58