Creating a http Client in Cake 3
<p>I am having trouble getting a response from an API using a <code>http Client</code> in Cake PHP 3</p>

<p>I want to send the following <code>GET</code> request but I cannot manage to return a result. If visit this url with a browser i get a response.</p>

<pre><code>http://XX.XX.XX.XX:8020/mvapireq/?apientry=newuseru&amp;authkey=XXXXXXXXXX&amp;u_username=NEWUSERNAME&amp;u_password=PASSWORD&amp;u_name=NAME&amp;u_email=EMAIL&amp;u_phone=PHONE&amp;u_currency=USD&amp;u_country=USA&amp;u_address=x&amp;deviceid=DEVICEID&amp;now=555
</code></pre>

<p>When I try to send the same request with <code>http Client</code> my reponse object is always <code>null</code></p>

<pre><code>use Cake\Network\Http\Client;
use Cake\Network\Http\Response;

public function foo(){    
    $http = new Client();
    $data = [
        'apientry' =&gt; 'newuseru',
        'authkey' =&gt; 'XXXXXXXX',
        'u_username' =&gt; 'NEWUSERNAME',
        'u_password' =&gt; 'PASSWORD',
        'u_name' =&gt; 'NAME',
        'u_email' =&gt; 'EMAIL',
        'u_phone' =&gt; 'PHONE',
        'u_currency' =&gt; 'USD',
        'u_country' =&gt; 'USA',
        'u_address' =&gt; 'x',
        'deviceid' =&gt; 'DEVICEID',
        'now' =&gt; '555'
    ];

    $response = $http-&gt;get('http://XX.XX.XX.XX:8020/mvapireq', $data);

    debug($response-&gt;body);
    debug($response-&gt;code);
    debug($response-&gt;headers);
}
</code></pre>

<p>This is the results from the <code>debug()</code> it seems to me like the request is not being sent.</p>

<pre><code>Notice (8): Trying to get property of non-object [APP/Controller/UsersController.php, line 1159]

/src/Controller/UsersController.php (line 1159)

null

Notice (8): Trying to get property of non-object [APP/Controller/UsersController.php, line 1160]

/src/Controller/UsersController.php (line 1160)

null

Notice (8): Trying to get property of non-object [APP/Controller/UsersController.php, line 1161]

/src/Controller/UsersController.php (line 1161)

null

/src/Controller/UsersController.php (line 1163)

null
</code></pre>

<p>I've tried many different ways of structuring <code>$http</code> and all of them have returned the same result. I really can't figure out whats going wrong. Any help would be great.</p>