I am somewhat new to php, but I do understand some of the key concepts of it, however nothing about STDIN, what it is and why I am getting this error.
I am developing with the eTrade API PHP SDK and the development community over there seems to be a ghost-town, and absolutely nothing here on stackoverflow.
Here is the result of the php script I am trying to run http://philiparudy.com/etrade/Samples/test_market.php
I guess I am confused about this simple sample script that they give you where the end of the php script looks like this:
function get_input($str)
{
echo "\nPlease enter * $str * : ";
return trim(fgets(STDIN));
}
function show_menu()
{
echo "\n\nChoose from following options..\n\n";
echo "1. Get Option Chain\n\n";
echo "2. Product Lookup\n\n";
echo "3. Get Expiry Dates\n";
echo "4. Get Quote\n";
echo "0. Exit\n";
echo "Enter your choice:";
$choice = trim(fgets(STDIN));
return $choice;
}
Above all of this is a switch function that is supposed to handle your input, but there is no place to put the input on the webpage?
I also tried copying and pasting this in the terminal to which I got an array of different errors. Am I missing the boat completely here?
file_get_contents()
may be simpler. Least, that's what I found in a few threads. – Funk Forty Niner Oct 1 '14 at 19:19$_GET
or$_POST
arrays. You won't get very far withfgets(STDIN)
— this will simply wait for a line of text to be entered from the keyboard (i.e., the one connected to your web server, which may not even exist) – r3mainer Oct 1 '14 at 19:43<?php
on top to tell PHP where the actual code starts and where the HTML template code ends - this is due to PHP's history as a web language that's still visible in the CLI. – Ulrich Eckhardt Oct 1 '14 at 20:17