restructure the code, this is so the curl instance won't close unexpectedly before curl_exec is called (issue relating to Laravel, IOC container using a job and service provider)
Dewald Laubscher
Branch: dewald-laubscher/mailchimp-api-php:master
Branch: mailchimp/mailchimp-api-php:master
Open
An issue I picked up using this package https://github.com/skovmand/mailchimp-laravel/issues/16 that uses this mailchimp package. The above mentioned package is a service provider that gives an instance of Mailchimp. - I am using Laravel 5.3. - php7 I use the dispatch command in a controller to dispatch a job and then the call is never made. By the time curl_exec is called I get $ch = 0.
The issue appears to be Laravel\jobs specific. (at least as far as I know)
The IOC container call method seem to lose the data of the curl instance. (e.g. $this->ch is 0)
My thinking (that is unconfirmed at this point).
The IOC container call method is called at a time where the curl instance is now closed (probably for security reasons). http://stackoverflow.com/questions/6887104/why-am-i-getting-http-code-0-from-curl#answer-6969738
Suggested fix:
Capture data in the constructor (e.g. $opts)
init curl instance before it is called
I actually did this on this package and it works for me.