I have made a script to login into Vbulletin through API
here is the code
<?php
include 'connector.class.php';
if ($connector==null)
{
$connector = new vbConnector();
}
$do=$_GET['do'];
if ($do=="login")
{
$user_name=$_GET['username'];
$user_pass=$_GET['password'];
$res= $connector->doLogin($user_name,$user_pass, 1);
echo $res;
}
When I request this through url eg (http://example.com?do=login&username=test&password=test) it works perfectly and everything is fine
How ever when I try to curl or file_get_content the same url , it never logs me is
Here is some of my trials
<?php
$opts = array('http' => array('header'=> 'Cookie: ' . $_SERVER['HTTP_COOKIE']."\r\n"));
$context = stream_context_create($opts);
echo file_get_contents("http://192.168.5.55/vb_api/index.php?do=login&username=test&password=test");
You did not pass $context
in your file_get_contents call. Try this:
<?php
$opts = array('http' => array('header'=> 'Cookie: ' . $_SERVER['HTTP_COOKIE']."\r\n"));
$context = stream_context_create($opts);
echo file_get_contents("http://192.168.5.55/vb_api/index.php?do=login&username=test&password=test",false,$context);
?>
I know this is old but I just found this related link to my post, hope that solves your problem.