3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php require 'vendor/autoload.php'; Dotenv::load(__DIR__); $sendgrid_apikey = getenv('YOUR_SENDGRID_APIKEY'); $sendgrid = new SendGrid($sendgrid_apikey); $url = 'https://api.sendgrid.com/'; $pass = $sendgrid_apikey; $template_id = '<your_template_id>'; $js = array( 'sub' => array(':name' => array('Elmer')), 'filters' => array('templates' => array('settings' => array('enable' => 1, 'template_id' => $template_id))) ); $params = array( 'to' => "test@example.com", 'toname' => "Example User", 'from' => "you@youremail.com", 'fromname' => "Your Name", 'subject' => "PHP Test", 'text' => "I'm text!", 'html' => "<strong>I'm HTML!</strong>", 'x-smtpapi' => json_encode($js), ); $request = $url.'api/mail.send.json'; $session = curl_init($request); curl_setopt($session, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); curl_setopt($session, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $sendgrid_apikey)); curl_setopt ($session, CURLOPT_POST, true); curl_setopt ($session, CURLOPT_POSTFIELDS, $params); curl_setopt($session, CURLOPT_HEADER, false); curl_setopt($session, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($session); curl_close($session); print_r($response);
Output for 7.3.0rc3
Warning: require(): open_basedir restriction in effect. File(vendor/autoload.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/dQOSq on line 2 Warning: require(vendor/autoload.php): failed to open stream: Operation not permitted in /in/dQOSq on line 2 Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.:') in /in/dQOSq on line 2
Process exited with code 255.
Output for 7.1.10, 7.2.0, 7.3.0alpha1 - 7.3.0beta1
Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /in/dQOSq on line 2 Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.:') in /in/dQOSq on line 2
Process exited with code 255.
Output for 7.1.20, 7.2.6
Warning: require(): open_basedir restriction in effect. File(vendor/autoload.php) is not within the allowed path(s): (/tmp:/in) in /in/dQOSq on line 2 Warning: require(vendor/autoload.php): failed to open stream: Operation not permitted in /in/dQOSq on line 2 Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.:') in /in/dQOSq on line 2
Process exited with code 255.
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.1.7
Warning: require(): open_basedir restriction in effect. File(vendor/autoload.php) is not within the allowed path(s): (/tmp/) in /in/dQOSq on line 2 Warning: require(vendor/autoload.php): failed to open stream: Operation not permitted in /in/dQOSq on line 2 Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.:') in /in/dQOSq on line 2
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: require(vendor/autoload.php): File not found in /in/dQOSq:2 Stack trace: #0 {main}
Process exited with code 255.