Posts

Showing posts with the label unirest

PHP Fatal error: Uncaught UnirestException: Bad URL

PHP Fatal error: Uncaught UnirestException: Bad URL I'm trying to request a REST API using PHP Unirest. The printed error is the following: Bad URL, colon is first character And my code: <?php require __DIR__ . '/../vendor/autoload.php'; use UnirestRequest as UniRequest; use CurlFile; if (isset($_POST['primeiro'])) { $where = $_POST["where"]; $equal = $_POST["equal"]; $resultado = new pedidos; $valores = $resultado->LogIgualA($where, $equal); } class pedidos { function LogIgualA($where, $equal) { $wsURL = "localhost:8080/public"; try { $valores = UniRequest::get($wsURL."/visual/json_log/where=".$where."/equal=".$equal, $headers, null); } catch (Exception $e) { echo $e->getMessage(); } $valoresAux = $valores->body; $valores = ; foreach($valoresAux as $z){ $ID = $z->ID; $DateConnect...