this 저장소의 타사 SnapChat API를 사용하려고합니다.PHP SnapChat Master - 잘못된 로그인을 반환하는 올바른 로그인 자격 증명
다음은 현재 실행중인 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에서 내 올바른 사용자 이름과 암호를 입력 할 때마다 페이지 내 디버그 INVALID
문을 표시합니다. 나는 왜 이런 일이 일어나는 지 확신하지 못한다. 로그인 할 때 (TRUE == TRUE와 같은) 항상 true 체크를 추가하면 완벽하게 작동한다.
누구나 내가 잘못하고있는 것을 설명 할 수 있습니까?
: 그와 같은 $ CURL_OPTIONS을 snapchat_agent.php 수정할 수 이동합니다
이 "API"에서 사용하는 사용자 에이전트를 수정해야합니다 비록 기술적으로 불가능하고 그들은 그것을 받아 들여야하지만 불량 클라이언트를 방어 할 또 다른 시간입니다. 긴급한 경우 앱을 직접 MITM하여 라이브러리를 수정할 수 있습니다. 그렇지 않으면 다른 사람이 그 일을 할 때까지 기다리십시오. –