...

View Full Version : type in url search box and save contents in txt file



tau9
03-23-2009, 02:07 PM
Hi,

I am trying to create a submit box that will allow users to enter a url and press submit. By pressing the submit button this will save the contents of the address in to a txt file. I can save the contents using curl but I have to specify the address in the same file. How do I write to the file so users can enter their own address and then the file should run and save the contents in a txt file.

Here is some code I found at www.example.com

$ch = curl_init("http://www.example.com/")
$fp = fopen("example.txt", "w");

thanks in advance

webh4x0r
03-23-2009, 03:33 PM
To clarify what you say:

1. User enter 'Google.com' in search box (I don't think it's search box. It's url to proxy, right ?)

2. Then, before you give 'Google.com' content to user,
you want to write html codes of 'Google.com' to file as google.com.txt

Is it correct?

I'm curious if it's useful 2 u ?


===================================
Gotta love it - http://knowlege-free.blogspot.com

NancyJ
03-23-2009, 07:19 PM
$url = $_POST['url'];
$filename = str_replace(array('http://','/','.'),array('','_'),$url).'.txt';

$content = file_get_contents($url);
file_put_contents($filename,$content);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum