[LON-CAPA-cvs] cvs: nsdl / lonsql

www lon-capa-cvs@mail.lon-capa.org
Thu, 17 Nov 2005 22:34:49 -0000


www		Thu Nov 17 17:34:49 2005 EDT

  Modified files:              
    /nsdl	lonsql 
  Log:
  Does the query. Parsing the result is going to be fun ... :-(
  
  
Index: nsdl/lonsql
diff -u nsdl/lonsql:1.2 nsdl/lonsql:1.3
--- nsdl/lonsql:1.2	Thu Nov 17 17:04:47 2005
+++ nsdl/lonsql	Thu Nov 17 17:34:49 2005
@@ -3,7 +3,7 @@
 # The LearningOnline Network
 # lonsql - LON TCP-NSDL Query Handler.
 #
-# $Id: lonsql,v 1.2 2005/11/17 22:04:47 www Exp $
+# $Id: lonsql,v 1.3 2005/11/17 22:34:49 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -113,7 +113,10 @@
 use Socket;
 use Fcntl;
 use Tie::RefHash;
-
+use HTML::LCParser();
+use LWP::UserAgent();
+use HTTP::Headers;
+use HTTP::Date;
 use File::Find;
 use localenroll;
 
@@ -847,7 +850,15 @@
 
 sub nsdl_query {
     my $query=shift;
-} 
+    my ($keyword)=($query=~/\"\%([^\%]+)\%\"/);
+    $keyword=&escape($keyword);
+    &logthis('Doing '.$keyword);
+    my $url='http://search.nsdl.org?verb=Search&s=0&n=500&q='.$keyword;
+    my $ua=new LWP::UserAgent;
+    my $response=$ua->get($url);
+
+    return [];
+}
 
 =pod