Reputation: 13
I using the following code for an external php file which is being executed through curl:
<?php
include ('wp-config.php'); //Not sure how to do it.
if (!empty($_POST['username']) && !empty($_POST['password'])) {
$username= $_POST['username'];
$password= $_POST['password'];
$url = 'http://www.example.com/RequestDetails?UserId='.$username.'&pass='.$password;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
$resultauth=curl_exec($ch);
curl_close($ch);
$result = file_get_contents($url);
/*----Working fine till now*/
if ($results == 'authenticated user'){
$auth_options = get_option( 'user_options' );
$auth_options['user'][$username] = array( 'verified'=>'pendingverified', 'timestamp'=> current_time( 'mysql' ) );
}
?>
The $auth_options['user'][$username]
is not working and I guess it is because this file is not linked to wordpress.
Does anybody know why that happens? Did I forget to include something?
Upvotes: 1
Views: 73