Click to See Complete Forum and Search --> : search engine


harita_hadraw
07-31-2006, 11:07 PM
i need help on building search engine that can integrate information from other search engine.please help me...

pcthug
08-01-2006, 03:13 AM
Whom is the other search engine? Do you have access to this search engine's database, etc?

harita_hadraw
08-01-2006, 03:16 AM
that is the problem...i need to integrate data from citeseer n obviously...i dont have the access to its database..can u help me?i need to make it like google...search into other search engine, merge the results.

pcthug
08-01-2006, 03:44 AM
When you speak of citeseer, are you referring to The scientific literature digital library (http://citeseer.ist.psu.edu)?

harita_hadraw
08-01-2006, 03:59 AM
yes...u r correct.that citeseer.can u help me?to retrieve the data from citeseer?

pcthug
08-01-2006, 04:15 AM
As the site uses the GET method of data encoding you could pass your query as
http://citeseer.ist.psu.edu/cis?q=<query>
include various other parameters (i.e. cs=). Then you would read the dynamically created page, focusing and extracting the results. This extracting process would simply read all results into a local format which you could then redisplay and reformat yourself.
Please note: Such replication may infringe certain copyright laws and therefore should not be practiced without strict permission from the site owner or collectively Citeseer.

harita_hadraw
08-01-2006, 04:23 AM
sorry..i didnt get that.i mean...where to put the "http://citeseer.ist.psu.edu/cis?q=<query>" in my codes?im really stuck here

harita_hadraw
08-01-2006, 04:25 AM
what is cs stands for?is it really just like that?ive try everything,but still cannot send my query to citeseer.

pcthug
08-01-2006, 04:40 AM
Ok, firstly: What (if any) server-side technologies (PHP, ASP, JAVA, CGI-PERL, ColdFusion, etc.) do you have available to you?

harita_hadraw
08-01-2006, 04:45 AM
im using php..

pcthug
08-01-2006, 05:15 AM
Try this little php script:

<?php

if(!isset($_GET['q']) || empty($_GET['q']))
{
echo <<<form
<form action="{$_SERVER['REQUEST_URI']}" method="get">
<input type="text" name="q">
<input type="submit" name="submit" value="Search">
</form>
form;
}

else
{
echo readfile("http://citeseer.ist.psu.edu/cis?q={$_GET['q']}");
}

?>

harita_hadraw
08-01-2006, 05:25 AM
while implementing this scripts,an error occured on line 5 (echo <<<form ) and line 10(form).y?n how to solve it?

harita_hadraw
08-01-2006, 05:31 AM
the form tag cannot be inside the php scripts..how 2 solve this?

pcthug
08-01-2006, 05:49 AM
For such an error to be trigged I am led to believe that you do not have Heredoc syntax support ad therefore are running on an ancient version of PHP (like < version 4), try this script instead:

<?php

if(!isset($_GET['q']) || empty($_GET['q']))
{
$self = $HTTP_GET_VARS['PHP_SELF'];
echo "<form action=\"$self\" method=\"get\">\n<input type=\"text\" name=\"q\">\n<input type=\"submit\" name=\"submit\" value=\"Search\">\n</form>\n";
}

else
{
$q = $HTTP_GET_VARS['q'];
echo readfile("http://citeseer.ist.psu.edu/cis?q=$q");
}

?>

harita_hadraw
08-01-2006, 06:47 AM
new problem exists

Warning: readfile("http://citeseer.ist.psu.edu/cis?q=information integration") - No error in c:\apache\htdocs\cari.php on line 12

Fatal error: Maximum execution time of 30 seconds exceeded in c:\apache\htdocs\cari.php on line 12

harita_hadraw
08-01-2006, 09:43 PM
i know now why the problem exists.it is because there's a space between the keywords, such as "information integration".it can onlys earch for one words not many words coz it cant read space.how to overcome this?

pcthug
08-02-2006, 03:20 AM
Try:

<?php

if(!isset($_GET['q']) || empty($_GET['q']))
{
echo "<form action=\"{$_SERVER['PHP_SELF']}\" method=\"get\">\n<input type=\"text\" name=\"q\">\n<input type=\"submit\" name=\"submit\" value=\"Search\">\n</form>\n";
}

else
{
$q = str_replace(' ', '+', $_GET['q']);
echo readfile("http://citeseer.ist.psu.edu/cis?q=$q");
}

?>

harita_hadraw
08-02-2006, 07:01 AM
got it...thanx a lot

harita_hadraw
08-03-2006, 02:41 AM
this is my code.the part of searching my database is done.the other part which is searching to citeseer encounter small problems.can u fix it?

<?php

$connection = mysql_connect('localhost','','') or die("Could not connect to MySQL " .mysql_error() );

$selection = mysql_select_db("db_cosrep") or die("Unable to select database. " .mysql_error());

$submit = $_POST["submit"];
$q = $_POST["q"];
if($submit == "Search >>")
{
$choice1=$_POST["choice1"];
if($choice1=="cosrep")
{
if(isset($_POST["q"]))
{
// create the query

$sql = "SELECT * FROM php_directory WHERE title LIKE '%$q%' ";

// execute query
$result = mysql_query($sql) or die("SQL select statement failed");

// retrieves a row data and returns it as an associative array
while ($row=mysql_fetch_array($result))
{

// display direct from array
echo "<table><tr width=100%>";
echo "<td width=80%><a target='_blank' href=$row[url1]><u>$row[title]</u></a></td><td width=20%>percentage</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=80%>$row[abstract]</td><td width=20%>$row[publishon]</td></tr>";
echo "<tr>";
echo "<td width=80%>$row[url]</td><td width=20%></td>";
echo "</tr></table>";
echo "<hr>";

}
}

}

if($choice1=="cosrepNciteseer")
{
$self = $HTTP_GET_VARS['PHP_SELF'];
$q = str_replace(' ', '+', $_GET['q']);
echo readfile("http://citeseer.ist.psu.edu/cis?q=$q");

}
}
?>

pcthug
08-03-2006, 04:07 AM
Try this:
<?php
$connection = mysql_connect('localhost','','') or die("Could not connect to MySQL " .mysql_error());
$selection = mysql_select_db('db_cosrep') or die("Unable to select database. " .mysql_error());
$submit = $_POST['submit'];
if($submit == "Search >>")
{
if(!isset($_POST['choice1']))
{
// found error
exit('DEBUG: choice1 not set!');
}

$choice1 = $_POST['choice1'];

if($choice1 == "cosrep")
{
if(isset($_POST['q']))
{
$q = $_POST['q'];
// create the query
$sql = "SELECT * FROM php_directory WHERE title LIKE '%$q%' ";
// execute query
$result = mysql_query($sql) or die("SQL select statement failed");
// retrieves a row data and returns it as an associative array
while ($row=mysql_fetch_array($result))
{
// display direct from array
echo "<table><tr width=100%>";
echo "<td width=80%><a target='_blank' href=$row[url1]><u>$row[title]</u></a></td><td width=20%>percentage</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=80%>$row[abstract]</td><td width=20%>$row[publishon]</td></tr>";
echo "<tr>";
echo "<td width=80%>$row[url]</td><td width=20%></td>";
echo "</tr></table>";
echo "<hr>";
}
}
}

elseif($choice1 == "cosrepNciteseer")
{
$q = str_replace(' ', '+', $_POST['q']);
echo readfile("http://citeseer.ist.psu.edu/cis?q=$q");
}
}
?>

harita_hadraw
08-03-2006, 05:25 AM
the code has no error but display nothing.y?

harita_hadraw
08-03-2006, 05:38 AM
it want to display.but suddenly it goes to blank page.not citeseer result page

pcthug
08-03-2006, 06:31 AM
Ok then, run this:

<?php
$connection = mysql_connect('localhost','','') or die("Could not connect to MySQL " .mysql_error());
$selection = mysql_select_db('db_cosrep') or die("Unable to select database. " .mysql_error());
$submit = $_POST['submit'];
if($submit == "Search >>")
{
if(!isset($_POST['choice1']))
{
// found error
exit('DEBUG: $_POST[\'choice1\'] not set.');
}

$choice1 = $_POST['choice1'];

if($choice1 == "cosrep")
{
if(isset($_POST['q']))
{
$q = $_POST['q'];
// create the query
$sql = "SELECT * FROM php_directory WHERE title LIKE '%$q%' ";
// execute query
$result = mysql_query($sql) or die("SQL select statement failed");
// retrieves a row data and returns it as an associative array
while ($row = mysql_fetch_array($result))
{
// display direct from array
echo "<table><tr width=100%>";
echo "<td width=80%><a target='_blank' href=$row[url1]><u>$row[title]</u></a></td><td width=20%>percentage</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=80%>$row[abstract]</td><td width=20%>$row[publishon]</td></tr>";
echo "<tr>";
echo "<td width=80%>$row[url]</td><td width=20%></td>";
echo "</tr></table>";
echo "<hr>";
}
}

else
{
// found error
exit('DEBUG: $_POST[\'q\'] not set.');
}
}

elseif($choice1 == "cosrepNciteseer")
{
$q = str_replace(' ', '+', $_POST['q']);
echo readfile("http://citeseer.ist.psu.edu/cis?q=$q");
}

else
{
// found error
exit('DEBUG: $choice1 value not "cosrep" or "cosrepNciteseer".');
}

}
else
{
// found error
exit('DEBUG: $submit not equal to "Search >>".');
}

?>

harita_hadraw
08-04-2006, 06:53 AM
the codes goes to blank page.at 1st..it does display the citeseer result page,but after 5 secs it goes to blank page.

harita_hadraw
08-04-2006, 06:55 AM
i need to display the result on the same page of my database search result

harita_hadraw
08-04-2006, 07:07 AM
perhaps the readfile code?

pcthug
08-04-2006, 07:10 AM
So where would you like the citeseer results to appear? Under your database results, above? If so, what is the use of $choice1? Please Explain.

harita_hadraw
08-06-2006, 12:25 AM
there is 2 radio button.1 is to search from my database only(its easy n its done).the 2nd is search to citeseer n my database together,then combine the results(form search to citeseer n my database) rank it n then display the result.how to do it then?can u help me?

harita_hadraw
08-06-2006, 12:34 AM
this is my form page source code..

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<head><title>Computer Science Research Paper in malaysia</title>
<meta name="Microsoft Theme" content="copy-of-sonora11111111 1011">

<base target="main">
</head>

<body>
<form method="post" action="main5.php" target="mainFrame" >
<div style="position: absolute; width: 203px; height: 29px; z-index: 1; left: 476px; top: 57px" id="layer1">
<img src=pbc.bmp></div>
<p align="center" style="line-height: 150%">
<input type="text" name="q" size=40> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="submit" value="Search >>">
</p>
<p align="center" style="line-height: 150%">
<font size="4" face="Times New Roman">
<font size="4" face="Times New Roman">
<input type="radio" name="choice1" value="cosrep">CoSReP Only &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
<input type="radio" name="choice1" value="cosrepNciteseer">&nbsp;CoSReP + Citeseer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>
</font><font face="Arial, Helvetica, sans-serif" size="2">


</form>



</body>
</html>


while this is my action page....the results need to be display on this page...

<?php
$connection = mysql_connect('localhost','','') or die("Could not connect to MySQL " .mysql_error());
$selection = mysql_select_db('db_cosrep') or die("Unable to select database. " .mysql_error());
$submit = $_POST['submit'];
if($submit == "Search >>")
{
if(!isset($_POST['choice1']))
{
// found error
exit('DEBUG: choice1 not set!');
}

$choice1 = $_POST['choice1'];

if($choice1 == "cosrep")
{
if(isset($_POST['q']))
{
$q = $_POST['q'];
// create the query
$sql = "SELECT * FROM php_directory WHERE title LIKE '%$q%' ";
// execute query
$result = mysql_query($sql) or die("SQL select statement failed");
// retrieves a row data and returns it as an associative array
while ($row=mysql_fetch_array($result))
{
// display direct from array
echo "<table><tr width=100%>";
echo "<td width=100%><a target='_blank' href=$row[url1]><u>$row[title]</u></a></td><td width=20%>$hit</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=100%>$row[abstract]</td><td width=20%>$row[publishon]</td></tr>";
echo "<tr>";
echo "<td width=100%>$row[url]</td>";
echo "</tr></table>";
echo "<hr>";
}
}
}

elseif($choice1 == "cosrepNciteseer")
{
$q = str_replace(' ', '+', $_GET['q']);
echo readfile("http://citeseer.ist.psu.edu/cis?q=$q");

}
}
?>

for the cosrep n cieseer radio button...it should be able to search to my own database n citeseer,rank the results n display it..how to do it?

pcthug
08-06-2006, 01:02 AM
To rank the results some type of algorithm must be used, this algorithm could easily be used with just your results - however when combining 2 sets of results (one of which we can't access directly) accurate ranking becomes near impossible.

harita_hadraw
08-06-2006, 02:17 AM
if i cant rank the result,at least i could combine the search result.thats all i need to do for now.can u help me?maybe,i could retrieve the result from citeseer and save it to my database or something.for at least i could combine the search result.

pcthug
08-06-2006, 05:33 AM
What is the value of $hit:

echo "<td width=100%><a target='_blank' href=$row[url1]><u>$row[title]</u></a></td><td width=20%>$hit</td>";

pcthug
08-06-2006, 05:36 AM
And $row['abstract'] and $row['publishon']?
echo "<td width=100%>$row[abstract]</td><td width=20%>$row[publishon]</td></tr>";
The reason I ask is because I'm trying to format the citeseer results the same as your database results and i'm not sure where to get this information from.

pcthug
08-06-2006, 05:43 AM
So far I have this (Not Tested):

<?php

// check that post variables exist
if(isset($_POST['submit'])) {

$choice1_list = array('cosrep', 'cosrepNciteseer');

// validate choice1 input
if(!isset($_POST['choice1']) || !in_array($_POST['choice1'], $choice1_list) {
$choice1 = $choice1_list[0];
}
else {
$choice1 = $_POST['choice1'];
}

// cleanup search query
$q = trim($_POST['q'])
if(@get_magic_quotes_gpc()) {
stripslashes($q);
}

// ensure query is not empty
if(empty($q)) {
exit('No keywords specified.');
}

// escape query to prevent sql injection attacks
$q = mysql_real_escape_string($q);

// connect and select database
mysql_connect('localhost','','') or die("Could not connect to MySQL " .mysql_error());
mysql_select_db('db_cosrep') or die("Unable to select database. " .mysql_error());

// execute query
$result = @mysql_query("SELECT * FROM php_directory WHERE title LIKE '%$q%' ");

// strip slashes for later use
$q = stripslashes($q);

if(mysql_num_rows($result) < 1) {
$no_results = true;
}

else {
while($row = mysql_fetch_assoc($result)) {
echo "<table><tr width=100%>\n";
echo "<td width=100%><a target='_blank' href=$row[url1]><u>$row[title]</u></a></td><td width=20%>$row[hit]</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=100%>$row[abstract]</td><td width=20%>$row[publishon]</td></tr>\n";
echo "<tr>\n";
echo "<td width=100%>$row[url]</td>\n";
echo "</tr></table>\n";
echo "<hr>\n\n";
}
}

// if selected, display citeseer results as well
if($choice1 == $choice1_list[1])
{
// perform citeseer query
citeseer_query($q);

// if no results found, tell user
if(preg_match('<!--RLS--><!--RLE-->', $data) and $no_results) {
exit("No documents found matching: <em>$q</em>");
}

// display results of query
citeseer_results($q);
}

exit;
}

function citeseer_query($query) {
$query = str_replace(' ', '+', $query);
return readfile("http://citeseer.ist.psu.edu/cis?q=$query");
}

function citeseer_results($query) {
$results = preg_split('<!--RIS--><a href="(.*?)">(.*?)</a>\n\n&nbsp; <a href="(.*?)"><font color=#6f6f6f>(.*?)</font></a> &nbsp; <a href="(.*?)">\((\d{1,3})&nbsp;citations\)</a>\n<br>\n<font color=black>(.*?)</font><br><font color=green>(.*?)</font>\n<!--RIE-->', $query)

$return = array();

foreach($results as $result) {
preg_replace('<!--RIS--><a href="(.*?)">(.*?)</a>\n\n&nbsp; <a href="(.*?)"><font color=#6f6f6f>(.*?)</font></a> &nbsp; <a href="(.*?)">\((\d{1,3})&nbsp;citations\)</a>\n<br>\n<font color=black>(.*?)</font><br><font color=green>(.*?)</font>\n<!--RIE-->', "<table><tr width=100%>\n<td width=100%><a target='_blank' href=\\1><u>\\2</u></a></td><td width=20%></td>\n</tr>\n<tr>\n<td width=100%></td><td width=20%></td></tr>\n<tr>\n<td width=100%>\\1</td>\n</tr></table>\n<hr>\n\n");
$return[] = $result;
}

return $return;
}

else { ?><html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<head><title>Computer Science Research Paper in malaysia</title>
<meta name="Microsoft Theme" content="copy-of-sonora11111111 1011">

<base target="main">
</head>

<body>
<form method="post" action="main5.php" target="mainFrame" >
<div style="position: absolute; width: 203px; height: 29px; z-index: 1; left: 476px; top: 57px" id="layer1">
<img src=pbc.bmp></div>
<p align="center" style="line-height: 150%">
<input type="text" name="q" size=40> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="submit" value="Search &raquo;">
</p>
<p align="center" style="line-height: 150%">
<font size="4" face="Times New Roman">
<font size="4" face="Times New Roman">
<input type="radio" name="choice1" value="cosrep">CoSReP Only &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
<input type="radio" name="choice1" value="cosrepNciteseer">&nbsp;CoSReP + Citeseer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>
</font><font face="Arial, Helvetica, sans-serif" size="2">


</form>



</body>
</html><?php exit;
} ?>

harita_hadraw
08-06-2006, 06:27 AM
never mind about $hit
$abstract is the abstract of the paper
$publishon is the date the paper is published
i really thank u for ur help

pcthug
08-06-2006, 07:47 PM
Ok then, well from the citeseer database I only have The link URL, Document title, Correctness, Number of Citations, A short description of the document and it's original source. From this information what should I substitute $abstract and $publishion with? Currently they are simply being left blank:

<?php

// check that post variables exist
if(isset($_POST['submit'])) {

$choice1_list = array('cosrep', 'cosrepNciteseer');

// validate choice1 input
if(!isset($_POST['choice1']) || !in_array($_POST['choice1'], $choice1_list) {
$choice1 = $choice1_list[0];
}
else {
$choice1 = $_POST['choice1'];
}

// cleanup search query
$q = trim($_POST['q'])
if(@get_magic_quotes_gpc()) {
stripslashes($q);
}

// ensure query is not empty
if(empty($q)) {
exit('No keywords specified.');
}

// escape query to prevent sql injection attacks
$q = mysql_real_escape_string($q);

// connect and select database
mysql_connect('localhost','','') or die("Could not connect to MySQL " .mysql_error());
mysql_select_db('db_cosrep') or die("Unable to select database. " .mysql_error());

// execute query
$result = @mysql_query("SELECT * FROM php_directory WHERE title LIKE '%$q%' ");

// strip slashes for later use
$q = stripslashes($q);

if(mysql_num_rows($result) < 1) {
$no_results = true;
}

else {
while($row = mysql_fetch_assoc($result)) {
echo "<table><tr width=100%>\n";
echo "<td width=100%><a target='_blank' href=$row[url1]><u>$row[title]</u></a></td><td width=20%>$row[hit]</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=100%>$row[abstract]</td><td width=20%>$row[publishon]</td></tr>\n";
echo "<tr>\n";
echo "<td width=100%>$row[url]</td>\n";
echo "</tr></table>\n";
echo "<hr>\n\n";
}
}

// if selected, display citeseer results as well
if($choice1 == $choice1_list[1])
{
// perform citeseer query
citeseer_query($q);

// if no results found, tell user
if(preg_match("'<!--RLS--><!--RLE-->'", $data) and $no_results) {
exit("No documents found matching: <em>$q</em>");
}

// display results of query
citeseer_results($q);
}

exit;
}

function citeseer_query($query) {
$query = str_replace(' ', '+', $query);
return readfile("http://citeseer.ist.psu.edu/cis?q=$query");
}

function citeseer_results($query) {
$results = preg_split("'<!--RIS--><a href=\"(.*?)\">(.*?)</a>\n\n&nbsp; <a href=\"(.*?)\"><font color=#6f6f6f>(.*?)</font></a> &nbsp; <a href=\"(.*?)\">\((\d{1,3})&nbsp;citations\)</a>\n<br>\n<font color=black>(.*?)</font><br><font color=green>(.*?)</font>\n<!--RIE-->'", $query)

$return = array();

foreach($results as $result) {
preg_replace("'<!--RIS--><a href=\"(.*?)\">(.*?)</a>\n\n&nbsp; <a href=\"(.*?)\"><font color=#6f6f6f>(.*?)</font></a> &nbsp; <a href=\"(.*?)\">\((\d{1,3})&nbsp;citations\)</a>\n<br>\n<font color=black>(.*?)</font><br><font color=green>(.*?)</font>\n<!--RIE-->'", "'<table><tr width=100%>\n<td width=100%><a target='_blank' href=\\1><u>\\2</u></a></td><td width=20%></td>\n</tr>\n<tr>\n<td width=100%></td><td width=20%></td></tr>\n<tr>\n<td width=100%>\\1</td>\n</tr></table>\n<hr>\n\n'");
$return[] = $result;
}

return $return;
}

else { ?><html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<head><title>Computer Science Research Paper in malaysia</title>
<meta name="Microsoft Theme" content="copy-of-sonora11111111 1011">

<base target="main">
</head>

<body>
<form method="post" action="main5.php" target="mainFrame" >
<div style="position: absolute; width: 203px; height: 29px; z-index: 1; left: 476px; top: 57px" id="layer1">
<img src=pbc.bmp></div>
<p align="center" style="line-height: 150%">
<input type="text" name="q" size=40> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="submit" value="Search &raquo;">
</p>
<p align="center" style="line-height: 150%">
<font size="4" face="Times New Roman">
<font size="4" face="Times New Roman">
<input type="radio" name="choice1" value="cosrep">CoSReP Only &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
<input type="radio" name="choice1" value="cosrepNciteseer">&nbsp;CoSReP + Citeseer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>
</font><font face="Arial, Helvetica, sans-serif" size="2">


</form>



</body>
</html><?php exit;
} ?>

harita_hadraw
08-07-2006, 11:05 PM
abstract is the short description of the document(on citeseer),while publishon should be the date that document is published.left it behind,i still cant think wut to replace.

harita_hadraw
08-07-2006, 11:44 PM
ive tried the code u gave me...it has error on line 9;

if(!isset($_POST['choice1']) || !in_array($_POST['choice1'], $choice1_list) {

harita_hadraw
08-10-2006, 05:16 AM
ive overcome the error..now,exists new error n i really need ur help.please help me.

this is ur code that ive edited...

<?php

// check that post variables exist
if(isset($_POST['submit']))
{

$choice1_list = array('cosrep', 'cosrepNciteseer');

// validate choice1 input
if(!isset($_POST['choice1']) || !in_array($_POST['choice1'], $choice1_list))
{
$choice1 = $choice1_list[0];
}
else {
$choice1 = $_POST['choice1'];
}

// cleanup search query
$q = trim($_POST['q']);
if(@get_magic_quotes_gpc())
{
stripslashes($q);
}

// ensure query is not empty
if(empty($q)) {
exit('No keywords specified.');
}

// escape query to prevent sql injection attacks
$q = mysql_real_escape_string($q);

// connect and select database
mysql_connect('localhost','','') or die("Could not connect to MySQL " .mysql_error());
mysql_select_db('db_cosrep') or die("Unable to select database. " .mysql_error());

// execute query
$result = @mysql_query("SELECT * FROM php_directory WHERE title LIKE '%$q%' ");

// strip slashes for later use
$q = stripslashes($q);

if(mysql_num_rows($result) < 1)
{
$no_results = true;
}

else
{
while($row = mysql_fetch_assoc($result))
{
echo "<table><tr width=100%>\n";
echo "<td width=100%><a target='_blank' href=$row[url1]><u>$row[title]</u></a></td><td width=20%>$row[hit]</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=100%>$row[abstract]</td><td width=20%>$row[publishon]</td></tr>\n";
echo "<tr>\n";
echo "<td width=100%>$row[url]</td>\n";
echo "</tr></table>\n";
echo "<hr>\n\n";
}
}

// if selected, display citeseer results as well
if($choice1 == $choice1_list[1])
{
// perform citeseer query
citeseer_query($q);

// if no results found, tell user
if(preg_match("'<!--RLS--><!--RLE-->'", $data) and $no_results)
{
exit("No documents found matching: <em>$q</em>");
}

// display results of query
citeseer_results($q);
}

exit;
}

function citeseer_query($query)
{
$query = str_replace(' ', '+', $query);
return readfile("http://citeseer.ist.psu.edu/cis?q=$query");
}

function citeseer_results($query)
{
$results = preg_split("'<!--RIS--><a href=\"(.*?)\">(.*?)</a>\n\n&nbsp; <a href=\"(.*?)\"><font color=#6f6f6f>(.*?)</font></a> &nbsp; <a href=\"(.*?)\">\((\d{1,3})&nbsp;citations\)</a>\n<br>\n<font color=black>(.*?)</font><br><font color=green>(.*?)</font>\n<!--RIE-->'", $query);

$return = array();

foreach($results as $result)
{
preg_replace("'<!--RIS--><a href=\"(.*?)\">(.*?)</a>\n\n&nbsp; <a href=\"(.*?)\"><font color=#6f6f6f>(.*?)</font></a> &nbsp; <a href=\"(.*?)\">\((\d{1,3})&nbsp;citations\)</a>\n<br>\n<font color=black>(.*?)</font><br><font color=green>(.*?)</font>\n<!--RIE-->'", "'<table><tr width=100%>\n<td width=100%><a target='_blank' href=\\1><u>\\2</u></a></td><td width=20%></td>\n</tr>\n<tr>\n<td width=100%></td><td width=20%></td></tr>\n<tr>\n<td width=100%>\\1</td>\n</tr></table>\n<hr>\n\n'");
$return[] = $result;
}

return $return;
}
?>

<?php exit; ?>

n it has error that says:

Fatal error: Call to undefined function: mysql_real_escape_string() in c:\apache\htdocs\cosrepmal\main5.php on line 31

please sir,i really need your help

harita_hadraw
08-12-2006, 11:22 PM
every problems has been settled.thanx to you sir...

lastly...there only exist 1 single problem...it do display the result...but suddenly,it goes blank.why is that happen?i guess because of the readfile function.

how to overcome this?

harita_hadraw
08-19-2006, 07:57 AM
how do i save all the information i grab from citeseer in my database?please...i really need ur help

pcthug
08-20-2006, 06:13 AM
Why do you need to spider the citeseer database? Couldn't you just display the relative query?

harita_hadraw
08-20-2006, 07:20 AM
i need to integrated the result between citeseer result n my database result.that is y i need to save all those queried results into my database.besides,the readfile function display all the results page including citeseer search input box.plz,i really need ur help.