3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Your ID and token $blogID = '8070105920543249955'; $authToken = 'OAuth 2.0 token here'; // The data to send to the API $postData = array( 'kind' => 'blogger#post', 'blog' => array('id' => $blogID), 'title' => 'A new post', 'content' => 'With <b>exciting</b> content...' ); // Create the context for the request $context = stream_context_create(array( 'http' => array( // http://www.php.net/manual/en/context.http.php 'method' => 'POST', 'header' => "Authorization: {$authToken}\r\n". "Content-Type: application/json\r\n", 'content' => json_encode($postData) ) )); // Send the request $response = file_get_contents('https://www.googleapis.com/blogger/v3/blogs/'.$blogID.'/posts/', FALSE, $context); // Check for errors if($response === FALSE){ die('Error'); } // Decode the response $responseData = json_decode($response, TRUE); // Print the date from the response echo $responseData['published'];
Output for git.master, git.master_jit, rfc.property-hooks
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/7P8UU on line 26 Warning: file_get_contents(): open_basedir restriction in effect. File(https://www.googleapis.com/blogger/v3/blogs/8070105920543249955/posts/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/7P8UU on line 26 Warning: file_get_contents(https://www.googleapis.com/blogger/v3/blogs/8070105920543249955/posts/): Failed to open stream: Operation not permitted in /in/7P8UU on line 26 Error

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:
38.7 ms | 402 KiB | 8 Q