Jump to content

Archived

This topic is now archived and is closed to further replies.

vidyashankara

System commands in PHP?

Recommended Posts

Here is the problem i am facing. I want a script that download a file into the server(into a destined folder). I am guessing i need to use the system(wget) command for that.

<form name='pdb_id' method=POST action=download.php>
<input type=text name=id>
<input type='submit' name='submit' value='Download PDB File'>
</form>

when the user types into the id into the text field, i want the script to download the following file into \uploaded_pdb\ folder

the file is at
[a href=\"http://www.rcsb.org/pdb/downloadFile.do?fileFormat=pdb&compression=NO&structureId=$id\" target=\"_blank\"]http://www.rcsb.org/pdb/downloadFile.do?fi...tureId=$id[/a]

where $id is the text the user inputs.

for example,
if the user inputs 1AV1
the server should download
[a href=\"http://www.rcsb.org/pdb/downloadFile.do?fileFormat=pdb&compression=NO&structureId=1AV1\" target=\"_blank\"]http://www.rcsb.org/pdb/downloadFile.do?fi...tructureId=1AV1[/a]

and save it in /uploaded_pdb/

what do you think i should do now?

$pdb = system(get [a href=\"http://www.rcsb.org/pdb/downloadFile.do?fileFormat=pdb&compression=NO&structureId=$id)\" target=\"_blank\"]http://www.rcsb.org/pdb/downloadFile.do?fi...ureId=$id)[/a]

is that correct? it isnt working...
I am running on linux!

Any help would be appreciated!

Thanks a lot
Vidyashankar

Share this post


Link to post
Share on other sites
Not sure i understod the problem, but i gave it a go anyways:
If the problem is that you dont get the $id in download.php to
say the same as te user typed in the textbox:




Try this:

This line gets the text the user typed ito the textbox called "id".
(it needs to bee in the target file:)

<form name='pdb_id' method=POST action=download.php>
<input type=text name=id>
<input type='submit' name='submit' value='Download PDB File'>
</form>


download.php:

$id = $_POST['id']; // should return the text the user typed

Not sure if this helps you in anyway
but it was worth the try :-)

Raila

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.