Files
fathom/testsubmit.php
2022-04-28 12:43:33 -05:00

67 lines
1.7 KiB
PHP

<?php
$url = $_POST['url'];
$ctx = $_POST['ctx'];
$keywords = $_POST['keywords'];
$language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
$title = $_POST['title'];
$searchprefix = "/search/searchresults.aspx?ctx=";
$searchmiddle = "&type=Boolean&term=";
$searchsuffix = "&sort=RELEVANCE&limit=&query=&page=0";
$searchjoiner = "%20and%20";
echo '<strong>URL:</strong> '.$url.'<br />';
echo '<strong>CTX:</strong> '.$ctx.'<br />';
echo '<strong>Keyword(s):</strong> '.$keywords.'<br />';
echo '<strong>Langauge:</strong> '.$language.'<br />';
echo '<strong>Title:</strong> '.$title.'<br />';
// Check for data
$la = 'la='.$language;
if (!empty($keywords)) {
$kw = 'kw='.$keywords;
}
if (!empty($title)) {
$urlend = $searchjoiner.'ti='.$title.$searchsuffix;
} else {
$urlend = $searchsuffix;
}
echo '<h3>Constructed link</h3>';
//echo $url.'/'.$ctx.'/';
// $address = implode(", ", array_filter(array($addressline1, $addressline2, $addressline3));
$SearchURL = implode("", array_filter(array($url, $searchprefix, $ctx, $searchmiddle, $la, $searchjoiner, $kw, $urlend)));
echo '<a href="'.$SearchURL.'">'.$SearchURL.'</a><br /><br />';
$ConstructedURL = $url.$searchprefix.$ctx.$searchmiddle.$kw.'%20and%20la='.$language.$searchsuffix;
echo '<a href="'.$ConstructedURL.'">'.$ConstructedURL.'</a>';
// https://ccs.polarislibrary.com/polaris/search/searchresults.aspx?ctx=14.1033.0.0.35&type=Boolean&term=COL=YOTHER%20and%20MAT=KIT%20and%20LA=POL%20and%20GENRE=games&sort=RELEVANCE&page=0
// https://escondido.librarycatalog.info/polaris/search/searchresults.aspx?ctx=3.1033.0.0.6&type=Boolean&term=kw=batgirl
/*
Search for:
* Keyword
* Title
* Author
* Language
* Subject Heading
* Collection Code
* Material Type
* ISBN
*/
?>