3v4l.org

run code in 300+ PHP versions simultaneously
<?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 git.master, git.master_jit, rfc.property-hooks
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: Uncaught Error: Failed opening required 'vendor/autoload.php' (include_path='.:') in /in/dQOSq:2 Stack trace: #0 {main} thrown in /in/dQOSq on line 2
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:
36.02 ms | 402 KiB | 8 Q