/** * Update profile * * @return Response */ public function updateProfile() { $session = Session::get('user'); $userService = new SoapClient(Config::get('wsdl.user'), array()); $geoService = new SoapClient(Config::get('wsdl.utility'), array()); $currentUser = $userService->getUserByEmail(array('email' => $session['data']->email))->user; $currentUser->businessName = Input::get('businessName'); $currentUser->about = Input::get('about'); $currentUser->address = $geoService->getAddressByZipcode(array("zipcode" => Input::get('zipCode')))->address; $currentUser->website = Input::get('website'); $currentUser->contactName = Input::get('contactName'); $currentUser->contactNumber = Input::get('contactNumber'); $currentUser->email = Input::get('email'); try { $userService->updateUser(array('user' => $currentUser)); } catch (Exception $ex) { } }
public function profile() { $file = Input::file('uploader'); $destinationPath = app_path() . '/storage/uploads/'; $filename = $file->getClientOriginalName(); Input::file('uploader')->move($destinationPath, $filename); $image = ImageModel::createImageModel($filename); try { $session = Session::get('user'); $userService = new SoapClient(Config::get('wsdl.user')); $currentUser = $userService->getUserById(array("userId" => $session['data']->id)); $currentUser = $currentUser->user; $currentUser->avatar = $image; $result = $userService->updateUser(array("user" => $currentUser)); return Response::json($result->complete); } catch (Exception $ex) { } }
/** * Update profile * * @return Response */ public function updateProfile() { $session = Session::get('user'); $userService = new SoapClient(Config::get('wsdl.user'), array()); $geoService = new SoapClient(Config::get('wsdl.utility'), array()); $currentUser = $userService->getUserByEmail(array('email' => $session['data']->email))->user; if (!$currentUser->address) { $address = new Address(); } else { $address = new Address($currentUser->address); } $currentUser->firstName = Input::get('first_name'); $currentUser->lastName = Input::get('last_name'); $currentUser->about = Input::get('about'); if (Input::get('zipCode')) { $address = $geoService->getAddressByZipcode(array("zipcode" => Input::get('zipCode'))); $currentUser->address = $address->address; } else { if (Input::get('zipCode') == "") { $currentUser->address = new Address(); } } try { $userService->updateUser(array('user' => $currentUser)); } catch (Exception $ex) { } }
/** * Delete store * * @return Response */ public function destroy($id) { $session = Session::get('user'); $userService = new SoapClient(Config::get('wsdl.user'), array()); $currentUser = $userService->getUserByEmail(array('email' => $session['data']->email))->user; if (is_object($currentUser->addresses)) { $currentUser->addresses = array($currentUser->addresses); } $addresses = $currentUser->addresses; foreach ($addresses as $k => $val) { if ($val->id == $id) { $val->deleted = true; $addresses[$k] = $val; } } $currentUser->addresses = $addresses; try { $userService->updateUser(array('user' => $currentUser)); } catch (Exception $ex) { } }
function out($str) { echo $str . "\n"; } ini_set('soap.wsdl_cache_enabled', 0); $username = '******'; //$_POST['username']; $password = '******'; //md5($_POST['password']); //$client = new SoapClient("https://srvfh13.fh-luebeck.de/moodle/moodleplugin.wsdl",array('trace'=>1,'login'=>$username,'password'=>$password)); $client = new SoapClient("https://www.myserver.com/moodle/moodleplugin.wsdl"); try { $sessid = ''; out($sessid = $client->login($username, $password)); out($client->addUser($sessid, 'testheinz', '1234', 'Heinz', 'Test', '*****@*****.**')); out($client->updateUser($sessid, 'testheinz', 'Heinzi', 'Tester', '*****@*****.**')); out($sessid = $client->logout($sessid)); out($client->deleteUser($sessid, 'testheinz')); //echo $client->exportUsers(2, 'CF101'); //echo $client->importCourses($xml_string,"Prova"); //echo $client->exportCourses(); //echo $client->exportCourses(3,"Prova"); //echo $client->exportCategories(); } catch (SoapFault $sf) { //echo $client->__getLastRequest(); echo $client->__getLastResponse(); echo $sf->faultstring; } /*else { if (empty($_SERVER[HTTPS])) {
<?php // client $options = array('location' => 'http://localhost/soap/user.php', 'uri' => 'http://localhost/soap/'); // $client=new SoapClient("user.wsdl"); $client = new SoapClient("http://localhost/soap/user.php?wsdl"); // var_dump($client->register('Goh','aasd','*****@*****.**','')); // var_dump($client->login('*****@*****.**','aasd','')); // var_dump($client->activateAccount('*****@*****.**','24419')); // var_dump($client->recaptchaKey()); $temp = array("Name" => "Puay Hiang", "Email" => "*****@*****.**", "Password" => "asd"); //,"Password"=>"Hello" $Email = "*****@*****.**"; $Password = "******"; $SessionKey = $client->login($Email, $Password, "asd")[1]; echo $SessionKey; var_dump($client->updateUser(json_encode($temp), $Password, $SessionKey));