Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http_build_query default separator not explicit #1

Open
sikjoy opened this issue Mar 6, 2014 · 0 comments
Open

http_build_query default separator not explicit #1

sikjoy opened this issue Mar 6, 2014 · 0 comments

Comments

@sikjoy
Copy link

sikjoy commented Mar 6, 2014

require_once getcwd() .'/sites/all/vendor/piplcom/piplapis-php/src/piplapis/search.php';

$params = array(
'api_key' => 'redacted',
'first_name' => 'Test',
'middle_name' => '',
'last_name' => 'Test',
'city' => 'Beverly Hills',
'country' => 'US',
'state' => 'CA',
'phone' => '8885550123',
'email' => '[email protected]',
);
$request = new PiplApi_SearchAPIRequest($params);
$request->send(FALSE);

results in the following exception:

PiplApi_SearchAPIError: The query does not contain any valid name/username/phone/email to search by in PiplApi_APIError::from_dict() (line 35 of vendor/piplcom/piplapis-php/src/piplapis/error.php).

I was able to fix the issue. See diff below:

diff --git a/src/piplapis/search.php b/src/piplapis/search.php
index c3266a9..c72c480 100644
--- a/src/piplapis/search.php
+++ b/src/piplapis/search.php
@@ -455,7 +455,7 @@ class PiplApi_SearchAPIRequest
'filter_records_by' => $this->_filter_records_by
);

  •    return self::$BASE_URL . http_build_query($query);
    
  •    return self::$BASE_URL . http_build_query($query, '', '&');
    

    }

    public function send($strict_validation=true)
    @@ -730,4 +730,4 @@ class PiplApi_SearchAPIError extends PiplApi_APIError
    // error.
    }

Apparently, my server was using '&' as the default http_build_query separator and this was causing problems with the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant