PHP did not work?

Home - PHP did not work?

Jordan Maulana asked 7 months ago

i followed PHP tutorial for mesosfer in GitHub

https://github.com/mesosfer/Mesosfer-PHP

i have installed all the requirements, but i wonder why it did not work at all..
if i miss the requirement, there will be an error, yes i experienced it .
Now i got all the requirements in latest version, there is no error anymore..
My code is as the same as in the tutorial.. why did not work???

12 Answers
Badrullami Staff answered 7 months ago

Hi Jordan,
Are you sure to put username and password correctly?
I just try to register with python then login with php and it works.
Thanks.

Jordan Maulana answered 6 months ago

i register all correctly,
i can login all account with android,

but login with PHP only succeed with PHP account,
and python login with python account..

Badrullami Staff answered 6 months ago

Hi Jordan,
Can you attach your code here? I wan’t try with my data.
Thanks. 

Jordan Maulana answered 6 months ago

<?php
require dirname(__DIR__).’\mesosfer\vendor\autoload.php’;
const APP_ID = “secret”;
const APP_KEY = “secret”;
$email = $_POST[’email’];
$password = $_POST[‘password’];
$client = new \GuzzleHttp\Client();
try{
$respAuth = $client->request(‘POST’, ‘https://api.mesosfer.com/api/v2/users/signin&#8217;, [
‘json’ => [’email’ => $email, ‘password’ => $password],
‘headers’ => [‘X-Mesosfer-AppId’ => APP_ID, ‘X-Mesosfer-AppKey’ => APP_KEY]
]);
$bodyAuth = (string) $respAuth->getBody();
$auth = json_decode($bodyAuth);
print_r($auth);
}
catch(Exception $e){
echo $e->getMessage();
}

that is login with php

Badrullami Staff answered 6 months ago

Hi Jordan,
I tried to run your source code. Register from python then login with php. It’s work like attached image below¬†:

Do you make sure that your registration process was successful?
 

Your Answer