picqer / picqer-php

PHP Client for the Picqer API
https://picqer.com/en/api
MIT License
18 stars 23 forks source link

Invalid argument supplied for foreach() #21

Closed ddeem closed 5 years ago

ddeem commented 5 years ago

C:\MAMP\htdocs\eye\vendor\picqer\api-client\src\Client.php

` protected function parseRawHeaders() { $parsedHeaders = [];

    foreach ($this->rawResponseHeaders as $header) {
        $headerPieces = explode(':', $header, 2);

        if (! isset($headerPieces[0]) || ! isset($headerPieces[1])) {
            continue;
        }

        $parsedHeaders[$headerPieces[0]] = trim($headerPieces[1]);
    }

    return $parsedHeaders;
}`

…\vendor\picqer\api-client\src\Client.php1005 foreach ($this->rawResponseHeaders as $header) { stuck on this i cant get any data, on laravel

casperbakker commented 5 years ago

What is de request you are doing? And what is de error you are getting?

ddeem commented 5 years ago

https://gyazo.com/eff297fdc6bc13af7df2ed5cfca5ba28 https://gyazo.com/ed73a2b18a55126267fd6a144788f2a1

https://**.picqer.com/api/v1/orders?orderid=** (tested in postman)

require '../vendor/autoload.php'; $apiClient = new Picqer\Api\Client('**', '**'); $apiClient->enableRetryOnRateLimitHit(); $apiClient->setUseragent('Eye'); $orderid_data = $_GET['id']; $results = $apiClient->getOrderByOrderid($orderid_data); var_dump($results);

stephangroen commented 5 years ago

Do you still have issues @ddeem? I'd like to help. Cannot reproduce this.

jobvankaathoven commented 5 years ago

I had the same issue, this error occurred for me when I was using the wrong subdomain credentials. This also happens when you leave the subdomain field blank. Make sure you are using the correct subdomain (and API key). The subdomain can be found at the base uri from your picqer account: https://[example-subdomain].picqer.com. More details at: https://picqer.com/en/api/basics