Created
July 28, 2018 15:12
-
-
Save rafarubert/56393e40ca1434f217feaadd4012408b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" dir="ltr"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Imprimir</title> | |
</head> | |
<body> | |
<?php | |
if (isset($_POST['cpf']) ): | |
$ch = curl_init(); | |
$postvars = $_POST; | |
$cpf = $postvars['cpf']; | |
$cpf = str_replace(".", "", $cpf); | |
$cpf = str_replace("-", "", $cpf); | |
$url = "https://sistema.autopceara.com.br/find/cpf/{$cpf}"; | |
curl_setopt($ch,CURLOPT_URL,$url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$resp = curl_exec($ch); | |
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); | |
$resp = json_decode( $resp, true ); | |
curl_close($ch); | |
if( $httpcode != "422" ): | |
$id = str_pad( $resp['id'] , 13, "0", STR_PAD_LEFT); | |
$name = str_replace(" ", "\ ", $resp['name']); | |
$company = str_replace(" ", "\ ", $resp['company_name']); | |
exec("/home/server/print.sh $name $company $id"); | |
endif; | |
endif; | |
?> | |
<h1>Autop - Imprimir</h1> | |
<form action="/" method="POST" > | |
<input type="text" name="cpf" /> | |
<input type="submit" /> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment