0

I'm trying to use the API of a dutch site that's being used by schools in The Netherlands to keep track of the grades and other data of the students. You can find the documantation here: http://www.magister-api.nl/ (it's in Dutch). I installed Wamp server and Composer, just like the documentation of the API tells. I also have the Curl PHP extension and Mcrypt PHP extension enabled in Wamp, just like the documentation tells. I have the composer.json file in the project root with:

{
   "require": {
      "stanvk/magister": "~2.0"
   }
}

I then executed Composer update.

The only code that I have is:

<?php

require 'vendor/autoload.php';

use Magister\Magister;
use Magister\Models\Grade\Grade;

new Magister($school, $username, $password);

$grades = Grade::all();

foreach ($grades as $grade)
{
        echo $grade->CijferStr;
}
?>

It's the exact same code as given as example on the documentation website.

But when I then run it, I get these errors:

Errors

I tried a lot to solve the problem, but I can't seem to figure it out. It's the first time I'm using composer and packagist.

Sheeps
  • 3
  • 3

1 Answers1

0

The first two errors are unrelated to composer or Wamp - you're simply using two variables that hasn't been defined, $username and $password (and possibly $school). The rest of the errors seems to stem from these having no value (the Magister object seems to try to request username.magister.net, and without a username .. that field is empty).

Provide the correct username and password and things will probably work as you expect.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • I povided the correct information and defined the variables, but I'm still getting: https://gyazo.com/d4c0f5c561bcbf9ea2ff1ab6e812d554 – Sheeps Jul 03 '16 at 14:24
  • You'll need to [set the `curl.cainfo` setting in your php.ini](http://stackoverflow.com/a/23585500/137650). This is a common issue under Windows with the current Wampserver builds at least. – MatsLindh Jul 03 '16 at 19:29