How run a query in command prompt to get results from a PHP web server??

I have a web site in PHP and i want to query it but through command prompt.
This site shows me all the content in DB related to a keyword that i want to look for.

What query can i execute?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
You probably want to get hold of a tool like Curl or WGet

Command line utils that can download a webpage.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Julian HansenCommented:
There is also bitsadmin on Windows 7 and Powershell

Powershell example

powershell -command "& { iwr -OutFile savedpage.txt }"

Bitsadmin has been deprecated in favour of PS - but you can google it if you need examples.
Dave BaldwinFixer of ProblemsCommented:
PHP normally works from the command.  I have quite a few PHP programs that run from the command line.  You won't see an HTML display like you would in a web browser but you can save the results to a file.
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Julian HansenCommented:
Just bear in mind that running a PHP page from the command line might not function as expected due to dependence on server pre-processing ($_GET, $_POST, $_SERVER, $_COOKIES etc)
Dave BaldwinFixer of ProblemsCommented:
Things like that are always true.  Here is a simple PHP program that runs both on the web server and the command line.
/// DB configuration for 'dibsiam03'
$dbhost = "";    // Your database server
$dbuser = "username";      // Your db username
$dbpass = "password";      // Your db password
$dbname = "database name";      // Your database name
$dbtable = "tablename";  // tablename
$dbh = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
$dbsel = mysql_select_db($dbname) or die(mysql_error());
echo $dbh." :: ".$dbsel."<br>";
$sql = "SELECT * FROM $dbtable LIMIT 4";
$res = mysql_query($sql);
if (!$res)  print "<option>mysql_query failed, ".mysql_error()."</option>";
//$row = mysql_fetch_array($res);
while ($row = mysql_fetch_array($res, MYSQL_NUM)) {
echo '<table><tr>';
echo '<td>'.$row[0]."</td>\r\n";
echo '<td>'.$row[1]."</td>\r\n";
echo '<td>'.$row[2]."</td>\r\n";
echo '<td>'.$row[3]."</td>\r\n";
echo '<td>'.$row[4]."</td>\r\n";
echo '<td>'.$row[5]."</td>\r\n";
echo '<td>'.$row[6]."</td>\r\n";
echo '</tr></table>';

Open in new window

acunaaraAuthor Commented:
Dave.. I am using a client computer so, i cannot execute that command in the server directly since my only access is a web page, this is because of permissions.

Because of that i am trying to use the command prompt in order to make several queries with different keywords and the only output for each query is YES or NO.
Dave BaldwinFixer of ProblemsCommented:
As I said, I ran that PHP program on the command line to get data from a different computer.  If PHP is installed on the client computer you can run it or one modified for your needs on the client to get info from the server.  But I think if the only output is YES or NO then you are talking about accessing a PHP program on a web server.  The basic idea is no different.
acunaaraAuthor Commented:
I've requested that this question be deleted for the following reason:

No valid answers
Julian HansenCommented:
Please advise as to why none of the answers provided were valid? There were many suggestions that were valid in terms of querying a website from a command prompt?
Julian HansenCommented:
Answers were provided that in the context of the question are valid. Asker has not provided any details on why the posted solutions are not suitable.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.