Closed markdboyd closed 7 years ago
I should add that my request URLs work fine if I paste them directly into the browser.
Is it possible that PHP's curl function isn't properly escaping the space in your query into %20
?
(Also, Sunlight strongly suggests using the https://
version of the API), as do I.)
I think I have it figured out. I was constructing my query string manually, which meant that maybe some parameters were not being escaped properly. I changed to building my query string via http_build_query
and things seem to be working.
Also, I definitely plan on switching to use HTTPS. Thanks!
I'm getting a 504 from the API:
https://congress.api.sunlightfoundation.com/bills/search?query=gun+control&apikey=API_KEY
Also, I notice that I get different results depending on whether my query is formatted as gun+control
or "gun control"
. Which one is the correct format?
Lastly, even when I wasn't getting 504, my requests to the API were periodically failing. Has anyone else noticed this?
This should be fixed now.
I've been having problems trying to query the bill search endpoint. I'm pretty sure that I'm doing something wrong, but I'm not sure what it is.
I'm using PHP as a backend and trying to use cURL to make the requests:
My response is always an empty string. I was previously prototyping the same functionality in Angular and having similar issues getting back empty responses. Is there some sort of CORS or user agent problem here?