I'm trying to load an authentication PHP file in my Symfony controller.
I must use it with require_once
(can't copy it). It contains a class for identification on my website.
This is what I tried so far:
/**
* @Route("/login")
* @Template()
*/
public function loginAction()
{
require_once("/usr/share/php/ariseid/client/OAuthAriseClient.php");
require_once("./config.inc.php");
$consumer = OAuthAriseClient::getInstance($consumer_key, $consumer_secret,$consumer_private_key);
$consumer->authenticate();
if ($consumer->has_just_authenticated()) {
session_regenerate_id();
$consumer->session_id_changed();
}
if ($consumer->is_authenticated()) {
$results = $consumer->api()->begin()
->get_identifiant()
->done();
try {
$_SESSION['AriseID'] = $results[0]();
}
catch(OAuthAPIException $e) {
echo "Erreur : ".$e->getMessage();
}
}
return $this->render('SlothBundle:Default:index.html.twig', array(
'islogged' => $consumer->is_authenticated(),
));
}
This is the error I'm getting:
CRITICAL - Fatal Error: Class'SlothBundle\Controller\OAuthAriseClient' not found Context: {"type":1,"file":"/home/users/assoces/separatiiste/html/src/SlothBundle/Controller/DefaultController.php","line":39,"level":-1,"stack":[{"function":"loginAction","type":"->","class":"SlothBundle\Controller\DefaultController","file":"/home/users/assoces/separatiiste/html/app/bootstrap.php.cache","line":3109,"args":[]},{"function":"call_user_func_array","file":"/home/users/assoces/separatiiste/html/app/bootstrap.php.cache","line":3109,"args":[]},{"function":"handleRaw","type":"->","class":"Symfony\Component\HttpKernel\HttpKernel","file":"/home/users/assoces/separatiiste/html/app/bootstrap.php.cache","line":3071,"args":[]},{"function":"handle","type":"->","class":"Symfony\Component\HttpKernel\HttpKernel","file":"/home/users/assoces/separatiiste/html/app/bootstrap.php.cache","line":3222,"args":[]},{"function":"handle","type":"->","class":"Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel","file":"/home/users/assoces/separatiiste/html/app/bootstrap.php.cache","line":2444,"args":[]},{"function":"handle","type":"->","class":"Symfony\Component\HttpKernel\Kernel","file":"/home/users/assoces/separatiiste/html/web/app_dev.php","line":29,"args":[]},{"function":"{main}","file":"/home/users/assoces/separatiiste/html/web/app_dev.php","line":0,"args":[]}]}
I tried with composer but it returns the same error.