¿Call webservice from PHP? / JsConnect and JsConnect Auto Sign in already installed
danytothetowers
New
Hello community,
I have running 100% correctly JsConnect + Auto Sign In on my forum, and I'm trying to integrate a webservice (https://oet.itesm.mx/portalOETWS/PortalOETWebService?wsdl) that gets user information automatically making the log in action.
This is my index.php where I think it might be placed the code containing the calling of the webservice from PHP
<?php
require('functions.jsconnect.php');
// 1. Get your client ID and secret here. These must match those in your jsConnect settings.
$clientID = "xxx";
$secret = "xxx";
// 2. Grab the current user from your session management system or database here.
// Webservice Call
$client = new SoapClient("https://oet.itesm.mx/portalOETWS/PortalOETWebService?wsdl");
$result = $client->validausuario(); <---- This is the method of the webservice that validates the user and gets his information to create the profile, I think that this is like GET method
$xml = $result->validausuario1Response; <--- And I think that this is like POST method of PHP, where the method has the information gives it to JsConnect ¿Am I right?
// XML Process
$xml = simplexml_load_string($xml);
foreach($xml->Table as $table)
{
$output .= "<p>$table->Name</p>";
}
print_r($output);
$signedIn = true; // this is just a placeholder
// YOUR CODE HERE.
// 3. Fill in the user information in a way that Vanilla can understand.
$user = array();
if ($signedIn) {
// CHANGE THESE FOUR LINES.
$user['uniqueid'] = '11223344';
$user['name'] = 'Wildfren Donovan';
$user['email'] = 'donovan@gmail.com';
$user['photourl'] = '';
}
// 4. Generate the jsConnect string.
// This should be true unless you are testing.
// You can also use a hash name like md5, sha1 etc which must be the name as the connection settings in Vanilla.
$secure = 'sha1';
WriteJsConnect($user, $_GET, $clientID, $secret, $secure); // for full page forum
JsSSOString($user, $clientID, $secret); // add this line if using an embedded forum (remove if not embedded)
I don't know If I need to integrate the code of the webservice with the part of if($signedIn) { //CHANGE THESE FOUR LINES or place it where it inside of some If - else ,
Don't worry, I'm still researching for information but It would be the world for me If I have your opinions and suggestions
Thanks again community
Tagged:
0