3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 投稿先とAPIトークンを指定 $room_id = yyyyyy; // ルームID。URLからも確認できます $api_token = "******************"; // APIトークン // メッセージ本文 $body = <<<EOD テストメッセージでござる。 このメッセージはChatwork APIにより自動で投稿されてるでござるよ。 EOD; // ヘッダ header("Content-type: text/html; charset=utf-8"); // POST送信データ $params = array( 'body' => $body ); // cURLに渡すオプションを設定 $options = array( CURLOPT_URL => "https://api.chatwork.com/v1/rooms/{$room_id}/messages", // URL CURLOPT_HTTPHEADER => array('X-ChatWorkToken: '. $api_token), // APIトークン CURLOPT_RETURNTRANSFER => true, // 結果を文字列で返す CURLOPT_SSL_VERIFYPEER => false, // サーバー証明書の検証を行わない CURLOPT_POST => true, // HTTP POSTを実行 CURLOPT_POSTFIELDS => http_build_query($params, '', '&'), // POST送信データ ); // cURLセッションを初期化 $ch = 1; // cURL転送用の複数のオプションを設定 //curl_setopt_array($ch, $options); // cURLセッションを実行 //$response = curl_exec($ch); // cURLセッションをクローズ //curl_close($ch); // 結果のJSON文字列をデコード $result = json_decode($response); // 結果を出力 (メッセージID返ってきてる) var_dump($result); ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught Error: Undefined constant "yyyyyy" in /in/o3PIc:4 Stack trace: #0 {main} thrown in /in/o3PIc on line 4
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught Error: Undefined constant "yyyyyy" in /in/o3PIc:4 Stack trace: #0 {main} thrown in /in/o3PIc on line 4
Process exited with code 255.
Output for 7.4.26 - 7.4.33
Warning: Use of undefined constant yyyyyy - assumed 'yyyyyy' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 4 Warning: Cannot modify header information - headers already sent by (output started at /in/o3PIc:4) in /in/o3PIc on line 16 Warning: Use of undefined constant CURLOPT_URL - assumed 'CURLOPT_URL' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 25 Warning: Use of undefined constant CURLOPT_HTTPHEADER - assumed 'CURLOPT_HTTPHEADER' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 26 Warning: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 27 Warning: Use of undefined constant CURLOPT_SSL_VERIFYPEER - assumed 'CURLOPT_SSL_VERIFYPEER' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 28 Warning: Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 29 Warning: Use of undefined constant CURLOPT_POSTFIELDS - assumed 'CURLOPT_POSTFIELDS' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 30 Notice: Undefined variable: response in /in/o3PIc on line 46 NULL
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.25
Warning: Use of undefined constant yyyyyy - assumed 'yyyyyy' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 4 Warning: Cannot modify header information - headers already sent by (output started at /in/o3PIc:4) in /in/o3PIc on line 16 Warning: Use of undefined constant CURLOPT_URL - assumed 'CURLOPT_URL' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 25 Warning: Use of undefined constant CURLOPT_HTTPHEADER - assumed 'CURLOPT_HTTPHEADER' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 26 Warning: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 27 Warning: Use of undefined constant CURLOPT_SSL_VERIFYPEER - assumed 'CURLOPT_SSL_VERIFYPEER' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 28 Warning: Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 29 Warning: Use of undefined constant CURLOPT_POSTFIELDS - assumed 'CURLOPT_POSTFIELDS' (this will throw an Error in a future version of PHP) in /in/o3PIc on line 30 NULL
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
NULL

preferences:
226.05 ms | 402 KiB | 300 Q