Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP SnapChat主机-正确的登录凭据返回无效的登录_Php_Html_Snapchat - Fatal编程技术网

PHP SnapChat主机-正确的登录凭据返回无效的登录

PHP SnapChat主机-正确的登录凭据返回无效的登录,php,html,snapchat,Php,Html,Snapchat,我正在尝试使用存储库中的第三方SnapChat API 下面是我正在运行的PHP代码 <?php /* TODO - Debug show errors */ error_reporting(E_ALL); ini_set('display_errors', 1); // Start or continue the session session_start(); // Require the php-snapchat-master api require_once("../api/s

我正在尝试使用存储库中的第三方SnapChat API

下面是我正在运行的PHP代码

<?php

/* TODO - Debug show errors */
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Start or continue the session
session_start();
// Require the php-snapchat-master api
require_once("../api/snapchat.php");
// If the user is logged in
if (isset($_SESSION["username"]) && isset($_SESSION["password"])) {
  // Redirect to the home page
  header("Location: ../home/");
}
// If the username and password are not set
else {
  // Break PHP to show HTML
  ?>
  <form method="POST">
    <input type="username" name="username" placeholder="Username" />
    <input type="password" name="password" placeholder="Password" />
    <input type="submit" value="Log In" />
  </form>
  <?php // End PHP break
  // If the log in form was submitted
  if (isset($_POST["username"]) && isset($_POST["password"])) {
    // Initialize the prospective user
    $snapchat = new Snapchat();
    // If the username and password are not valid
    if ($snapchat->login($_POST["username"], $_POST["password"]) == FALSE) {
      // ECHO INVALID
      echo "INVALID";
    }
    // If the username and password are valid
    else {
      // ECHO VALID
      echo "VALID";
      // Set the username session variable
      $_SESSION["username"] = $_POST["username"];
      // Set the password session variable
      $_SESSION["password"] = $_POST["password"];
      // Redirect to the home page
      header("Location: ../home/");
    }
  }
}
?>

不幸的是,每次我为SnapChat输入正确的用户名和密码时,页面都会显示我的debug
INVALID
语句。我不知道为什么会发生这种情况,当我为登录添加一个始终为true的检查(比如if(true==true)),那么它工作得非常好


有人能解释一下我做错了什么吗?

Snapchat的登录方法已更改:/因此此API需要更新。不要担心你的代码,没关系;)

编辑:已找到

您必须修改此“API”使用的用户代理: 转到snapchat_agent.php并修改$CURL_选项,如下所示:

public static $CURL_OPTIONS = array(
    CURLOPT_CONNECTTIMEOUT => 5,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_USERAGENT => 'Snapchat/8.1.1 (Nexus 5; Android 21; gzip)',
    CURLOPT_HTTPHEADER => array('Accept-Language: en'),
);

如果Snapchat的家伙们再次更改API以抵御流氓客户,我不会感到惊讶,即使这在技术上是不可能的,他们应该接受这一点;如果有紧急情况,你可以自己调试应用程序并修复库;否则,请等待其他人执行此操作。在发现更新后,“Snapchat/8.1.1”^需要更改为“Snapchat/9.0.1”