예제 #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     // Check connection status
     $command = $this->getApplication()->find('orange:status');
     $input = new ArrayInput(array('command' => 'orange:status'));
     $returnCode = $command->run($input, $output);
     if ($returnCode != 0) {
         $this->loginToOrange();
     }
 }
예제 #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->outputMessage('Logout from orange wifi ...');
     $client = new Client();
     try {
         $crawler = $client->request('GET', 'https://hautdebitmobile.orange.fr:8443/home/disconnect');
         // Output raw reponse if (-vv)
         if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_VERBOSE) {
             echo $client->getResponse();
         }
     } catch (\Exception $e) {
         $this->outputError('Connection error : ' . $e->getMessage(), true);
         exit(1);
     }
     $this->outputMessage('done');
 }
예제 #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->outputMessage('Testing connection to www.google.com ...');
     $client = new Client();
     try {
         $crawler = $client->request('GET', 'http://www.google.com');
     } catch (\Exception $e) {
         $this->outputError('Connection error : ' . $e->getMessage(), true);
         exit(1);
     }
     $input = $crawler->filterXPath("//input[@name='q']");
     if ($input->count() != 1) {
         $this->outputMessage('Looks like this is not Google', 'comment');
         return 1;
     } else {
         $this->outputMessage('Connection is alive !');
     }
 }