English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

can i use php in the form on a website i'm building to extract data from another website? Where i would just enter the URL of the part of the website i want the data extracted from in the form input field.?? help!

2007-05-22 04:27:04 · 2 answers · asked by elle66 1 in Computers & Internet Programming & Design

o yeh i think i made it sound dodgy but it isn't reli! you woul dknow what i mean if you knew the other details but its long to explain lol

2007-05-22 06:35:27 · update #1

2 answers

"extract data from another site" sounds a bit dodgy... and maybe not even very honnest!
But, well...
If I understand well:
You have your website, you write a file in PhP that has a form in it.
Your run your script, enters an URL on the form, click send, and your script accesses that URL. (jumps to the given page).
The problem is that a form is "posted" from your script to your server. On your server, there is another PhP script which responds to the data of the form. So, unless you have access to the other server, you can't do it! (but you can jump to the page, if it is not "cross-domain protected").
You cannot (legally) "download" the files from another domain without permission: you will need FTP access to the URL you target, that is username and pwds.
What you seem to want to do is called "hacking"...
And no-one will help you with that here...

2007-05-22 06:06:59 · answer #1 · answered by just "JR" 7 · 0 0

I'll help you :)

Its pretty simple really (if i understand you correctly).

So you have your form which goes to get_data.php, and you type in a url and then submit it.

In get_data.php you have this code:


$your_data = file_get_contents($_POST[url]);

?>

That will return the html contents of the page you requested.

It does not always work, because some people don't like scripts to go to their websites and steal their data. If it doesn't then you have to use CURL. Which is slightly more complicated, or a lot more complicated depending on how determined they are for you not to have it. :)

Hope that helps.

2007-05-22 19:48:15 · answer #2 · answered by Janet A 2 · 0 0

fedest.com, questions and answers