PHP code example of lovenery / lightopenid

1. Go to this page and download the library: Download lovenery/lightopenid library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lovenery / lightopenid example snippets


     $openid = new LightOpenID('my-host.example.org');

     $openid->identity = 'ID supplied by user';

     header('Location: ' . $openid->authUrl());
     

     $openid = new LightOpenID('my-host.example.org');

     if ($openid->mode) {
       echo $openid->validate() ? 'Logged in.' : 'Failed!';
     }
     

   $openid->realm = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
   $openid->returnUrl = $openid->realm . $_SERVER['REQUEST_URI'];
   

  $openid->>optional = array('namePerson/first');
  
  
  $openid->getAttributes();