diff --git a/scripts/lib/functions.php b/scripts/lib/functions.php new file mode 100644 index 0000000..b1cfd22 --- /dev/null +++ b/scripts/lib/functions.php @@ -0,0 +1,75 @@ + 0) + { + return true; + } + + if (!array_key_exists('REQUEST_METHOD', $_SERVER)) + { + return true; + } + + return false; +} + + +// --------------------------------------------------------- // +// Funktion til at gemme kun den data man har behov for +// --------------------------------------------------------- // +// Defining the basic scraping function +function scrape_between($data, $start, $end) +{ + $data = stristr($data, $start); // Stripping all data from before $start + $data = substr($data, strlen($start)); // Stripping $start + $stop = stripos($data, $end); // Getting the position of the $end of the data to scrape + $data = substr($data, 0, $stop); // Stripping all data from after and including the $end of the data to scrape + return $data; // Returning the scraped data from the function +} + +// --------------------------------------------------------- // +// Funktion til at gemme kun den data man har behov for +// --------------------------------------------------------- // +// Defining the basic scraping function +function scrape_to($data, $end) +{ + //$data = stristr($data, $start); // Stripping all data from before $start + //$data = substr($data, strlen($start)); // Stripping $start + $stop = stripos($data, $end); // Getting the position of the $end of the data to scrape + $data = substr($data, 0, $stop); // Stripping all data from after and including the $end of the data to scrape + return $data; // Returning the scraped data from the function +} + +// --------------------------------------------------------- // +// Funktion til at gemme kun den data man har behov for +// --------------------------------------------------------- // +// Defining the basic scraping function +function scrape_from($data, $start) +{ + $data = stristr($data, $start); // Stripping all data from before $start + $data = substr($data, strlen($start)); // Stripping $start + //$stop = stripos($data, $end); // Getting the position of the $end of the data to scrape + //$data = substr($data, 0, $stop); // Stripping all data from after and including the $end of the data to scrape + return $data; // Returning the scraped data from the function +} + + + +?> \ No newline at end of file