Deoctor Posted June 1, 2010 Share Posted June 1, 2010 Hai i have a code which runs in the browser, but i need to run it in the command prompt like this php <filename.php> <input> where filename.php is the file which i need to run and the <input> is the one where i need to give the one which i need to run.. dont know how to do this.. can any one help me.. sorry for BAD english.. Quote Link to comment https://forums.phpfreaks.com/topic/203505-need-small-help/ Share on other sites More sharing options...
ignace Posted June 1, 2010 Share Posted June 1, 2010 What is filename.php and where does input come from? Quote Link to comment https://forums.phpfreaks.com/topic/203505-need-small-help/#findComment-1066075 Share on other sites More sharing options...
Deoctor Posted June 1, 2010 Author Share Posted June 1, 2010 filename.php is the code which i am going to run and the <input> is the one which i need to give.. <?php function libxml_display_error($error) { $return = "<br/>\n"; switch ($error->level) { case LIBXML_ERR_WARNING: $return .= "<b>Warning $error->code</b>: "; break; case LIBXML_ERR_ERROR: $return .= "<b>Error $error->code</b>: "; break; case LIBXML_ERR_FATAL: $return .= "<b>Fatal Error $error->code</b>: "; break; } $return .= trim($error->message); if ($error->file) { $return .= " in <b>$error->file</b>"; } $return .= " on line <b>$error->line</b>\n"; return $return; } function libxml_display_errors() { $errors = libxml_get_errors(); foreach ($errors as $error) { print libxml_display_error($error); } libxml_clear_errors(); } // Enable user error handling libxml_use_internal_errors(true); $xml = new DOMDocument(); $xml->load('word.xml'); if (!$xml->schemaValidate('alto-1-4.xsd')) { print '<b>DOMDocument::schemaValidate() Generated Errors!</b>'; libxml_display_errors(); } else { echo "validated"; } ?> this is the code which i am using in this word.xml is the name of the input that i need to give while running at the command prompt as the input filename keeps on changing.. Quote Link to comment https://forums.phpfreaks.com/topic/203505-need-small-help/#findComment-1066076 Share on other sites More sharing options...
Alex Posted June 1, 2010 Share Posted June 1, 2010 Use the $argv array to get arguments passed to the script from the CLI. Quote Link to comment https://forums.phpfreaks.com/topic/203505-need-small-help/#findComment-1066084 Share on other sites More sharing options...
Deoctor Posted June 1, 2010 Author Share Posted June 1, 2010 this is not the one i am looking for, i need the file name to be given by me while giving the run only not after that .. Quote Link to comment https://forums.phpfreaks.com/topic/203505-need-small-help/#findComment-1066085 Share on other sites More sharing options...
Deoctor Posted June 1, 2010 Author Share Posted June 1, 2010 i got what i am looking for.. thank you all for ur help.. Quote Link to comment https://forums.phpfreaks.com/topic/203505-need-small-help/#findComment-1066101 Share on other sites More sharing options...
ignace Posted June 1, 2010 Share Posted June 1, 2010 i got what i am looking for.. thank you all for ur help.. Post it, so others who may stumble upon the same problem can learn from your experience. Quote Link to comment https://forums.phpfreaks.com/topic/203505-need-small-help/#findComment-1066165 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.