-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
30 lines (21 loc) · 817 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
//$fp = fopen('output.txt', 'w');
// create a new cURL resource
$curl = curl_init();
// set URL and other appropriate options
$ean = "4104420038165";
curl_setopt($curl, CURLOPT_URL, "https://www.gtinsuche.de/result?article=" . $ean);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36');
curl_setopt($curl, CURLOPT_FILE, $fp);
curl_setopt($curl, CURLOPT_HEADER, 0);
// grab URL and pass it to the browser
//$data = curl_exec($curl);
// close cURL resource, and free up system resources
curl_close($curl);
$file_data = file('output.txt');
$product = preg_grep('~^<span.*<br>~', $file_data);
foreach($product as $line){
$line = preg_replace('~<[^<]*>~', '', $line);
echo $line;
}
echo "done";