tags:

views:

195

answers:

2

Hi, My problem is a little bit hard but simple. I have (or there is) a web page (http://sub.domain.com/page.php). An application graps data from this page. My aim is to change this page, not change it but let the system grap the data from c:\page.php. How to do the redirection? Thanks

A: 

If you mean "Screen scrapping" then change the destination url in the "system" which is grabbing data. You cannont make the system to scrap from a file or folder (ex: c:\page.php". It has to be an url.

Shoban
+2  A: 

Like the others, I'm a little bit unclear on what exactly you're asking to do, but I have a good guess. Let me restate your question to see if I got the scenario correct:

You have an application which retrieves and processes data from an arbitrary web page. You do not have control over this application's behavior and the URL it is fetching is not a configurable option. You want to be able to override the URL and cause the application to instead pull data which you have produced instead of the default URL which it is pulling.

If the "page.php" page is the only data which your application pulls from sub.domain.com, then one simple method of subverting the normal behavior would be to override the DNS for sub.domain.com on your local nameserver or in the hosts file of the machine where the application is running. That would be /etc/hosts in Unix/Linux/OS X or %SystemRoot%\system32\drivers\etc\ on a modern Windows machine.

You could add an entry for sub.domain.com in the hosts file which pointed to the IP address of a web server you do control and then you could make that server respond with whatever content you wished.

If the application relies on more content from sub.domain.com then this approach might be too cumbersome to be practical, since you'd have to replicate all the data on your webserver which is pretending to be sub.domain.com somehow, leaving it normal while just transforming the page.php content.

Nugget