Jump to content


Photo

System commands in PHP?


  • Please log in to reply
2 replies to this topic

#1 vidyashankara

vidyashankara
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 21 April 2006 - 05:02 AM

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

#2 vidyashankara

vidyashankara
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 23 April 2006 - 05:23 AM

anyone know what to do?

#3 raila

raila
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 23 April 2006 - 07:05 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users