-1

I'm looking for a way for my laravel 4.1 app to integrate with an exchange server.

I found this script https://github.com/jamesiarmes/php-ews which seems to fit what I need. However I don't now how to integrate it into my laravel app.

I've copied the scripts to a folder in my app folder

I've created a controller in my controller folder:

<?php

require_once('/exchange-ews/ExchangeWebServices.php');
require_once('/exchange-ews/EWSAutodiscover.php');

require_once('/exchange-ews/EWSType/CalendarItemType.php');

/**
* Class to control EWS Exchnage
*/
class EwsController
{
public $server = 'xxxx';
public $username = 'xxx';
public $password = 'xxxx';
public $version = 'xxxx';

public function getCalendarEvent()
{
    $ews = new ExchangeWebServices($server, $username, $password, $version);
}

public function getServer()
{
    $ews = EWSAutodiscover::getEWS($this->$username, $this->password);

    return $ews;
}
}

In my routes i've created the following route:

Route::get('testEWS', function ()
{


$result = EwsController::getServer();

return $result;
});

So far this does nothing. When I call the route all I get is a server error but I'm unable to see what the error is. Simply a white screen.

I don't know enough yet to incorporate a non laravel package in my app. How do I do this?

Thanks

Update

Here's some output from xdebug error log at the point of error:

fl=php:internal
fn=php::ErrorException->__construct
133 7
fl=C:\wamp\www\golfmanager\golfmanager\vendor\laravel\framework\src\Illuminate\Exception\Handler.php
fn=Illuminate\Exception\Handler->handleError
129 12886
cfl=php:internal
cfn=php::error_reporting
calls=1 0 0
131 1
cfl=php:internal
cfn=php::ErrorException->__construct
calls=1 0 0
133 7
Ray
  • 3,018
  • 8
  • 50
  • 91
  • 1
    A white screen is a PHP error, please check your PHP logs for the error message. We can't help you without that. – Brandon May 18 '14 at 21:43
  • Thank you. I've looked at the apache log. All I have is a 500 error in the access.log - I logged the output from xdebug and posted above. I rely heavily on the output from laravel to debug and forget about the other logs and methods available. – Ray May 19 '14 at 05:41

1 Answers1

1

In the end the problem - once I started to dig into error logging and bypassing laravels error capturing it was a simple problem.

The error discovered was it couldnt open the included files.

I change my paths to base_app() . '/exchange-ews/ExchangeWebServices.php' and the error disappeared.

I now have another poblem which is for possibly another question.

Lesson learned: check the logs and display errors first. I also added the following to my route to ensure the errors got displayed ini_set('display_errors',1);

Thanks

Ray
  • 3,018
  • 8
  • 50
  • 91