PHP: command line options

Supposed that you have a command line like this:

 

How do you get that options in php?  Please note the “:” in the option

myscript.php --url "http://www.google.com" --proxy "127.0.0.1:8080"

 

<?php
$options = getopt("",array("url:","proxy:"));
print_r($options);
?>

Leave a Reply

Your email address will not be published. Required fields are marked *