3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = 'https://www.tiny.com.br/api2/produtos.pesquisa.php'; $token = 'coloque aqui a sua chave da api'; $pesquisa = 'xxxxx'; $data = "token=$token&pesquisa=$pesquisa&formato=XML"; enviarREST($url, $data); function enviarREST($url, $data, $optional_headers = null) { $params = array('http' => array( 'method' => 'POST', 'content' => $data )); if ($optional_headers !== null) { $params['http']['header'] = $optional_headers; } $ctx = stream_context_create($params); $fp = @fopen($url, 'rb', false, $ctx); if (!$fp) { throw new Exception("Problema com $url, $php_errormsg"); } $response = @stream_get_contents($fp); if ($response === false) { throw new Exception("Problema obtendo retorno de $url, $php_errormsg"); } return $response; }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $php_errormsg in /in/3q7DL on line 23 Fatal error: Uncaught Exception: Problema com https://www.tiny.com.br/api2/produtos.pesquisa.php, in /in/3q7DL:23 Stack trace: #0 /in/3q7DL(8): enviarREST('https://www.tin...', 'token=coloque a...') #1 {main} thrown in /in/3q7DL on line 23
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:
51.9 ms | 401 KiB | 8 Q