Php 我的vbulletin登录api无法通过文件获取内容工作

Php 我的vbulletin登录api无法通过文件获取内容工作,php,vbulletin,Php,Vbulletin,我已经制作了一个脚本,通过API登录到Vbulletin 这是密码 <?php include 'connector.class.php'; if ($connector==null) { $connector = new vbConnector(); } $do=$_GET['do']; if ($do=="login") { $user_name=$_GET['username'];

我已经制作了一个脚本,通过API登录到Vbulletin

这是密码

<?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;
    }

您没有在文件获取内容调用中传递
$context
。试试这个:

<?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);
?>

我知道这是旧的,但我刚刚找到这个相关链接到我的帖子,希望能解决你的问题

<?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);
?>