fg - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of fg.php
- <?php
- $Cookie = "";
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, 'https://arackiralama.egm.gov.tr/frm_arac_iade.aspx?plaka='.strtoupper($_GET["Plate"]).'&id=17d8d0b1-3239-489a-a967-d33a9073d790&tur=1');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
- curl_setopt($ch, CURLOPT_HTTPHEADER, [
- 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
- 'Accept-Language: en-US,en;q=0.9,tr;q=0.8',
- 'Cache-Control: max-age=0',
- 'Connection: keep-alive',
- 'Sec-Fetch-Dest: document',
- 'Sec-Fetch-Mode: navigate',
- 'Sec-Fetch-Site: none',
- 'Sec-Fetch-User: ?1',
- 'Upgrade-Insecure-Requests: 1',
- 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36',
- 'sec-ch-ua: "Chromium";v="110", "Not A(Brand";v="24", "Google Chrome";v="110"',
- 'sec-ch-ua-mobile: ?0',
- 'sec-ch-ua-platform: "Linux"',
- 'Accept-Encoding: gzip',
- ]);
- curl_setopt($ch, CURLOPT_COOKIE, $Cookie);
- $response = curl_exec($ch);
- curl_close($ch);
- $dom = new DOMDocument();
- @$dom->loadHTML($response);
- $xpath = new DOMXPath($dom);
- if($xpath->query('//*[@id="lbl_aracmarka"]/text()')->item(0)->nodeValue == null)
- {
- $result = array(
- "Status" => "false",
- "Message" => "Işlem başarısız, belirtilen plaka numarasına ait araç bilgisi bulunamadı!"
- );
- echo json_encode($result, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
- return;
- }
- $result = array(
- "Arac" => array(
- "Marka" => $xpath->query('//*[@id="lbl_aracmarka"]/text()')->item(0)->nodeValue,
- "Model" => $xpath->query('//*[@id="lbl_aracmodeli"]/text()')->item(0)->nodeValue,
- "ModelYili" => $xpath->query('//*[@id="lbl_aracmodelyili"]/text()')->item(0)->nodeValue,
- "Renk" => $xpath->query('//*[@id="lbl_aracrenk"]/text()')->item(0)->nodeValue,
- "YakitTuru" => $xpath->query('//*[@id="lbl_aracyakit"]/text()')->item(0)->nodeValue,
- ),
- "Response" => array(
- "Instance" => "true",
- "Message" => "Istenilen araç plakasına ait aracın bilgileri getirilmiştir!",
- "Limit" => "x"
- )
- );
- echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
- ?>
File Description
- fg
- PHP Code
- 14 Mar-2024
- 2.45 Kb
You can Share it:
Latest PHP Pastes