3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $apiID = '265C8E80'; $apiKey = 'D537CC92-8F71-4B08-91C7-B9602FE6988F'; // TaxCloud webservice $tcURL = 'https://api.taxcloud.net/1.0/Taxcloud/'; $customerID = 9; $cartItems = array(array('Index' => 0, 'ItemID' => '61', 'Price' => 123.00, 'Qty' => 1)); // set the cart id $cartID = '15'; $origin = array('Address1' => '1437 Minnesota Ave', 'City' => 'Duluth', 'State' => 'MN', 'Zip5' => '55802'); $dest = array('Address1' => '1145 Amarillo Ave', 'City' => 'Palo Alto', 'State' => 'CA', 'Zip5' => '94303',); $origin = array('Address1' => '333 place St.', 'City' => 'City', 'State' => 'AL', 'Zip5' => '36000'); $dest = array('Address1' => '111 someplace St.', 'City' => 'Seattle', 'State' => 'WA', 'Zip5' => '98101'); $exemptCert = null; $ch = curl_init($tcURL.'Lookup'); $params = array('apiLoginID' => $apiID, 'apiKey' => $apiKey, 'customerID' => $customerID, 'cartID' => $cartID, 'cartItems' => $cartItems, 'origin' => $origin, 'destination' => $dest, 'deliveredBySeller' => FALSE, 'exemptCert' => $exemptCert); curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_HTTPHEADER => array('Content-Type: application/json'), // Calculate sales tax for cart CURLOPT_POSTFIELDS => json_encode($params))); $response = (curl_exec($ch)); //var_dump($params); $response = json_decode(curl_exec($ch)); //var_dump($response); if($response->ResponseType == 0){ foreach($response->Messages as $message){ echo '<br>Error : '.$message->ResponseType.' - '.$message->Message; } }else{ foreach($response->CartItemsResponse as $cartItem){ echo '<br>Cart Item '.$cartItem->CartItemIndex.' : Tax Amount '.$cartItem->TaxAmount; } } curl_close($ch);
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/KBY0f:30 Stack trace: #0 {main} thrown in /in/KBY0f on line 30
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Notice: Cannot access property on non-object in /in/KBY0f on line 50 Notice: Cannot access property on non-object in /in/KBY0f on line 51 Warning: Invalid argument supplied for foreach() in /in/KBY0f on line 53
Output for 5.0.0 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/KBY0f on line 30
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: curl_init() in /in/KBY0f on line 30
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: curl_init() in /in/KBY0f on line 30
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: curl_init() in /in/KBY0f on line 30