LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to pass file content through URL using shell script (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-pass-file-content-through-url-using-shell-script-892050/)

swathikumar 07-16-2011 11:54 AM

How to pass file content through URL using shell script
 
Hi All,

I am calling a URL from shell script and passing few argumants,
Here i have to pass file content as one argument.

How can i pass file content through URL.

eg:
content=`cat /Users/test1.txt`
open http://localhost:8080?filecontent=$content

it is not working.

Please give me solution for this.

Thanks
SwathiKumar

kasl33 07-16-2011 01:50 PM

I'm guessing you're passing it to a Php script? I'm not sure how it would work on the shell script side, but here is what you would do on the Php side:

content=`cat /Users/test1.txt`


Code:

<?php
if(isset($_GET['filecontent'])){
  $content = $_GET['filecontent'];

  echo $content;

}
?>

We can at least start at this point if you haven't gotten this far.


All times are GMT -5. The time now is 04:06 PM.