petercoles / Betfair-Exchange

A simple-to-use PHP wrapper for the Betfair Exchange REST API
MIT License
14 stars 6 forks source link

I'm getting this error #3

Closed smurfiez closed 6 years ago

smurfiez commented 6 years ago

Argument 1 passed to PeterColes\Betfair\Http\Client::setMethod() must be an instance of PeterColes\Betfair\Http\string, string given, called in /home/iwon/5V5ESPORT.COM/cron/vendor/petercoles/betfair-exchange/src/Api/Auth.php on line 62 and defined in /home/iwon/5V5ESPORT.COM/cron/vendor/petercoles/betfair-exchange/src/Http/Client.php

Betfair::init('xxx', 'xxx', 'xxx+');

is the code I'm using to initialize.

petercoles commented 6 years ago

Which version of PHP are you using?

smurfiez commented 6 years ago

PHP 5.6.33

On Sun, Mar 4, 2018 at 9:34 PM, Peter Coles notifications@github.com wrote:

Which version of PHP are you using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/petercoles/Betfair-Exchange/issues/3#issuecomment-370229758, or mute the thread https://github.com/notifications/unsubscribe-auth/AE0j1X8W214ae6s6b-cB7nCTrj8taxhAks5ta-1TgaJpZM4SbT11 .

petercoles commented 6 years ago

The minimum supported version of PHP is 7.0, which is defined in the composer.json file. Unfortunately you're tripping over a PHP feature that was introduced in 7.0.0 so is incompatible with your version.

You could fork the repo and remove the string type hinting from the Http\Client class, but there are no guarantees that you won't run into other problems. I'd strongly recommend upgrading to PHP 7 if you can - it's way more performant than 5.

smurfiez commented 6 years ago

Alright thanks, switched over that part of the script to a server running PHP7 so that's all fine and dandy now. On a completely unrelated note, is it possible to retrieve odds from the exchange API

petercoles commented 6 years ago

It certainly is. You'd use the listMarketBook call in the Betting API.

smurfiez commented 6 years ago

Pardon my ignorance but how would I get the odds for a specific event?

On Tue, Mar 6, 2018 at 12:50 AM, Peter Coles notifications@github.com wrote:

It certainly is. You'd use the listMarketBook http://docs.developer.betfair.com/docs/display/1smk3cen4v3lu3yomq5qye0ni/listMarketBook call in the Betting API.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/petercoles/Betfair-Exchange/issues/3#issuecomment-370484571, or mute the thread https://github.com/notifications/unsubscribe-auth/AE0j1VVaWhdpH2HPoD1YNXiflecXJR4gks5tbWzVgaJpZM4SbT11 .

petercoles commented 6 years ago

You get odds for a market rather than for an event - most events will have multiple markets.

Although markets are always associated with an event, Betfair uses events in some very inconsistent ways. E.g a soccer match is usually an event, but for horse racing a whole day's racing is initially set up as just one event, though more events may be added later for the same race meeting as additional markets are added.

To get your head around this, I recommend just playing with the API and seeing what data you get back. You'll pretty quickly get a feel for how Betfair returns the data available for different sports.