[interchange-cvs] interchange - pvinci modified code/UserTag/get_url.tag

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Wed Jan 7 00:13:50 EST 2004


User:      pvinci
Date:      2004-01-07 05:13:50 GMT
Modified:  code/UserTag get_url.tag
Log:
Add user option to specify useragent

Revision  Changes    Path
1.5       +6 -1      interchange/code/UserTag/get_url.tag


rev 1.5, prev_rev 1.4
Index: get_url.tag
===================================================================
RCS file: /var/cvs/interchange/code/UserTag/get_url.tag,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- get_url.tag	18 Feb 2003 17:20:58 -0000	1.4
+++ get_url.tag	7 Jan 2004 05:13:50 -0000	1.5
@@ -6,7 +6,7 @@
 =pod
 
 usage: 
-[get-url url="valid_url" method="POST" strip=1 content_type="x-www-form-urlencoded" content="name=Brev" authuser="username" authpass="password"]
+[get-url url="valid_url" method="POST" strip=1 content_type="x-www-form-urlencoded" content="name=Brev" authuser="username" authpass="password" useragent="useragent string"]
 
 Uses the LWP libraries to fetch a URL and return the contents.
 
@@ -48,6 +48,10 @@
 	}
 	else { $method = "GET"; }
 
+        if($opt->{useragent} ) {
+                $ua->agent($opt->{useragent});
+        }
+
 	my $req = HTTP::Request->new($method, $url);
 
 	$req->content_type('application/x-www-form-urlencoded');
@@ -62,6 +66,7 @@
 	if($opt->{authuser} && $opt->{authpass}) {
 		$req->authorization_basic($opt->{authuser}, $opt->{authpass});
 	}
+
 
 	my $res = $ua->request($req);
 








More information about the interchange-cvs mailing list