LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-08-2015, 06:21 PM   #1
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Rep: Reputation: 61
Running PHP from command line with $_GET


Hey LQ,

Just curious how I might pass a $_GET variable to a php script from the command line, if it's even possible.
 
Old 06-09-2015, 01:36 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
Quote:
<?php
$first = $argv[1];
$scnd = $argv[2];

echo "first param is $first and second is $scnd \n";

?>
Save the script above as test.php and call it

php test.php aah ooh

$_GET is empty.
 
1 members found this post helpful.
  


Reply

Tags
$_get, command line, php



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
running a php script from command line leicaphotos Linux - Newbie 1 10-10-2008 01:24 PM
Problems running PHP script in command line Hondro Linux - Software 1 06-21-2007 04:16 AM
Problems running PHP scrip in command line Hondro Programming 0 06-21-2007 02:39 AM
Globals in PHP and Smarty ($_GET) vargadanis Programming 6 12-01-2006 07:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration