Jump to content

System commands in PHP?


vidyashankara

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
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.