How to make a plugin run some code when a specific URL is accessed in the WP site

Hi

I have some custom code that I want to run.

I want it to run like this-->
(a) User visits http://mysite.com/getdata
--> here I want the plugin's code to be invoked when the user visits "getdata" (or other URL slug)
(2) Now the plugin runs some code, and after that redirects the visitor to get some archived post data.

How do I do the above?

Thanks,
Arvind.