rickbakkr / somtoday Goto Github PK
View Code? Open in Web Editor NEWPHP wrapper for SomToday api
PHP wrapper for SomToday api
Sinds een update van SOM (net voor kerst) werkt mijn login script gebaseerd op deze code niet meer.
De https://school-elo.somtoday.nl/services/mobile/v10/Login/GetMD/user/pass/brin/
pagina geeft alleen "No service was found."
Edit: Daarom over naar de nieuwere optie (met dank aan Rick):
<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $post_to = "https://production.somtoday.nl/oauth2/token"; curl_setopt($ch, CURLOPT_URL, $post_to); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,"grant_type=password&username=".$uuid."\\".$email."&password=".$password."&scope=openid"); RDUwRTBDMDYtMzJEMS00QjQxLUExMzctQTlBODUwQzg5MkMyOnZEZFdkS3dQTmFQQ3loQ0RoYUNuTmV5ZHlMeFNHTkpY curl_setopt($ch, CURLOPT_HTTPHEADER, Array( 'Accept: application/json', 'Content-Type: application/x-www-form-urlencoded', 'Authorization: Basic RDUwRTBDMDYtMzJEMS00QjQxLUExMzctQTlBODUwQzg5MkMyOnZEZFdkS3dQTmFQQ3loQ0RoYUNuTmV5ZHlMeFNHTkpY' )); $return = curl_exec($ch); curl_close ($ch); $results = json_decode($return);
Je krijgt dus een JSON array terug voor verdere verwerking
Ik kwam er gisteren achter dat er een aantal scholen zijn die niet voorkomen in de lijst servers.somtoday.nl, maar wel toegang hebben tot SOMtoday. Voorbeeld hiervan is:
Gooise Scholen Federatie: https://somtoday.nl/gsf
Dit heeft er waarschijnlijk mee te maken dat SOMtoday over is gegaan van hun mobiele app op alleen nog maar de responsive website, en de lijst op servers.somtoday.nl blijkbaar niet meer geupdated wordt. Iemand een oplossing hiervoor?
Hoi, ik ben al een aantal dagen aan het proberen om deze library werkende te krijgen op mijn webhost.
Ik heb ingelogd via ssh in mijn web host. Daar heb ik cd /public_html/som/
gedaan. Nu in de som
directory heb ik de volgende command uitgevoerd: composer require rbakker/somtodayapi:v2.x-dev
(Zonder het :v2.x-dev
wilde hij niet werken). Nu ziet de public_html
er als volgt uit:
- public_html
- som
- index.php
- vendor
- autoload.php
- composer
- php-curl-class
- rbakker
- somtodayapi
- src
- SOMtodayAPI
- (Execptions, Interfaces, Models, Container.php & SOMtoday.php)
in /som/index.php/
zit het volgende script:
require("vendor/autoload.php");
//use SOMtodayAPI\SOMtoday; gaf de volgende error:
// Fatal error: Uncaught Error: Class 'SOMtodayAPI\SOMtoday' not found in example.nl/public_html/som/index:12 Stack trace: #0 {main} thrown in example.nl/public_html/som/index on line 12
use SOMtodayAPI\SOMtodayAPI\SOMtoday;
$allSchools = SOMtoday::getSchools();
print_r($allSchools);
Fatal error: Class 'SOMtodayAPI\Container' not found in example.nl/public_html/som/vendor/rbakker/somtodayapi/src/SOMtodayAPI/SOMtoday.php on line 16
Dat $allSchools
alle scholen output en dus de hele library werkt.
Ik hoop dat ik nu alle benodigde informatie heb gegeven om deze vraag oplosbaar te maken.
Groet,
Michiel
De pagina op 192.168.1.54 werkt niet
192.168.1.54 kan dit verzoek momenteel niet verwerken.
500
Mijn index.php
<?php
include 'somtoday.php';
$som = SOMtodayUser("-","-","-","-")
$som->changeHomeworkStatus("-","-", true)
?>
Hey,
Think this aint working anymore?
maybe time to archive this project then
Hoi,
Is er ook een manier om alle cijfers op te vragen in plaats van de cijfers van de laatste maand?
~Luca
Hoi, deze library ziet er goed uit, ik heb alleen een probleem met het inloggen.
Mijn school gebruikt (helaas) een zogeheten sso login. Wat inhoudt dat de inlog bij somtoday niet via de eigen api gaat maar, in de app, een browser opent waarin je wordt geredirect naar login.microsoftonline.com die weer redirect naar een inlogpagina van m'n school, die redirect naar microsoft, die weer redirect naar de app van SomToday. Ik was benieuwd of iemand hier een oplossing voor heeft gevonden. Ik krijg namelijk de volgende response terug:
Response als ik curl -v
gebruik:
* Trying 84.241.178.86...
* TCP_NODELAY set
* Connected to production.somtoday.nl (84.241.178.86) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: C=NL; postalCode=7411 HW; ST=Overijssel; L=Deventer; street=Singel 25; O=Topicus.Education B.V.; OU=Somtoday; OU=Wildcard SSL; CN=*.somtoday.nl
* start date: Aug 27 00:00:00 2018 GMT
* expire date: Aug 26 23:59:59 2020 GMT
* subjectAltName: host "production.somtoday.nl" matched cert's "*.somtoday.nl"
* issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO RSA Organization Validation Secure Server CA
* SSL certificate verify ok.
> POST /oauth2/token HTTP/1.1
> Host: production.somtoday.nl
> User-Agent: curl/7.64.1
> Accept: */*
> Authorization: Basic RDUwRTBDMDYtMzJEMS00QjQxLUExMzctQTlBODUwQzg5MkMyOnZEZFdkS3dQTmFQQ3loQ0RoYUNuTmV5ZHlMeFNHTkpY
> Content-Length: 113
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 113 out of 113 bytes
< HTTP/1.1 400 Bad Request
< Date: Fri, 05 Jun 2020 15:48:15 GMT
< Server: Apache
< Strict-Transport-Security: max-age=31536000; includeSubdomains
< X-Frame-Options: SAMEORIGIN
< X-Frame-Options: DENY
< Content-Type: application/json
< Content-Length: 95
< X-Robots-Tag: none
< X-UA-Compatible: IE=Edge
< Connection: close
<
* Closing connection 0
* TLSv1.2 (OUT), TLS alert, close notify (256):
{"error_description":"Invalid grant: Account has 2 attempts remaining","error":"invalid_grant"}
Ik hoop dat iemand mij hierbij kan helpen!
Hey,
Ik heb zojuist geprobeerd om mbv jouw code het huiswerkvinken te implementeren in mijn app maar het werkt niet. Dit is mijn url:
https://merewa-elo.somtoday.nl/services/mobile/v10/Agenda/Vink/<aToken>/<appointmentID>/<huiswerkID>/True
Ik krijg een error 404 not found terug.
Enig idee waarom dit niet werkt?
~Luca
Als ik inlog met een verzorger account, zie ik alleen maar het rooster van mij, niet van mijn broertje. Is er een specifieke methode hoe ik dit kan opvragen?
Hallo,
Wanneer ik inlog via de api dan krijg ik een 404 error.
Hoe los ik dit op?
PHP code:
$som = new SOMtodayUser("", "*", "grundel", "18CR");
var_dump($som->getGrades());
HTML output:
Warning: file_get_contents(https://somtoday.nl/grundel/services/mobile/v10/Login/CheckMultiLoginB64/******/*******/18CR): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\xampp\htdocs\som\somtoday.php on line 123
Warning: file_get_contents(Cijfers/GetMultiCijfersRecentB64/****//18CR/): failed to open stream: No such file or directory in C:\xampp\htdocs\som\somtoday.php on line 180
NULL
(heb de gebruikersnaam en wachtwoord vervangen naar ****)
Ik vroeg me af of je misschien profiel foto's kan toevoegen?
Hey RickBakkr,
Ik ben zelf wat aan het experimenteren met jouw SomtodayAPI.
Ik ben voornamelijk bezig met het nabouwen van jouw API in C#, zodat ik het kan gebruiken in bv. desktop applicaties of Android/IPhone Apps.
Ik heb zelf geen inzage op het API systeem van Somtoday, dus vandaar dat ik jouw API als richtlijn gebruik.
Maar terwijl ik hiermee bezig was merkte ik op dat je maar 100 items terug krijgt als je getGrades() uitvoert. Waarschijnlijk geldt dit niet alleen voor de cijfers, maar voor alle requests doe je doet naar Somtoday.
Is het dus mogelijk om een range op te geven, waarvan je de cijfers wilt krijgen. (dus van 0 tot 100, van 100 tot 200, enz.)
Wellicht handig als dit er ook komt voor Magister6 indien mogelijk uiteraard ;)!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.