Select Page

Microsoft introduced a new protocol for the data they put in the Azure cloud. It is called “OData”. MS also published some client and server tools to consume and produce OData (see: http://odataphp.codeplex.com/ ). The PHP consumer for OData has some trouble with non Windows systems. That’s strange because the doc’s for the tool say it should run on all platforms. The problem is with Windows specific slashes in the PHP source. To fix this make some changes in the files:

File: /Common/ACSUtil.php
Action: change all the slashes in the “require_once” part
Original

1
2
3
4
5
6
7
8
9
require_once 'ResourceMessages.php';
require_once 'CommonCollection.php';
require_once 'WebUtilHttpVerb.php';
require_once 'WebUtilHttpRequest.php';
require_once 'WebUtilMicrosoft_Http_Response.php';
require_once 'WebUtilHttpResponse.php';
require_once 'CommonHttpProxy.php';
require_once 'ExceptionACSUtilException.php';
require_once 'ExceptionInvalidOperation.php';

Change into

1
2
3
4
5
6
7
8
9
require_once 'Resource/Messages.php';
require_once 'Common/Collection.php';
require_once 'WebUtil/HttpVerb.php';
require_once 'WebUtil/HttpRequest.php';
require_once 'WebUtil/Microsoft_Http_Response.php';
require_once 'WebUtil/HttpResponse.php';
require_once 'Common/HttpProxy.php';
require_once 'Exception/ACSUtilException.php';
require_once 'Exception/InvalidOperation.php';

File: PHPDataSvcUtil.php line 129
Action: change “\” into “/”
Original

"\" . $this->_getFileName());

Change into

"/" . $this->_getFileName());

If you installed the OData PHP consumer according to the readme, then you should be able to generate a proxy file with a command like this:
– Open a Terminal
– Go to you OData dir (where PHPDataSvcUtil.php lives)
– Type: php PHPDataSvcUtil.php /uri=http://odata.netflix.com/Catalog
– Or if you are behind a proxy: php PHPDataSvcUtil.php /uri=http://odata.netflix.com/Catalog /ph=proxyserver /pp=8080
(Change “proxyserver” for your proxy server and “8080” for your proxy port)

The parameter “/out” also has a problem. That has not been fixed with these changes. Just generate the proxy in the current dir 🙂