passworks / passworks-api

Passworks API
http://api.passworks.io
17 stars 6 forks source link

PHP SDK Request.php #5

Closed Stacey940 closed 6 years ago

Stacey940 commented 6 years ago

I think there is some problem with the response sent in the Request.php file in PHP SDK.

It is not returning the stdClass Object. If you are doing this:

$api = new Passworks\Client('username', 'key', true); $icon = $api->createAsset('icon', 'full_path_of_file/crown.png'); var_dump($icon);

it will return NULL.

To return the object with the ids and other information for any of the Request made , we need to change this request function in Request.php

public function request($method, $url, $post_data=null, $headers=null)

I have modified below code and now its returning the stdClass Object

   //my code

    $header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
    $header = substr($result, 0, $header_size);
    $body = substr($result, $header_size);

    //mycode ends

    curl_close($curl);

   return json_decode($body);

Please check if its only me who was facing that issue or the SDK needs the Request.php corrected.

Thanks

lmmendes commented 6 years ago

@stacybot123 can you reopen this ticker in the Passworks PHP client https://github.com/passworks/passworks-php/issues issue tracker?

Also can you add the version of the PHP that you are using?

Stacey940 commented 6 years ago

Created in the Passworks PHP client