-
Notifications
You must be signed in to change notification settings - Fork 498
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
Always get "Bad request (400)" #335
Comments
Looks like the bad request is coming from GitHub itself. |
Thanks for the suggestion! |
Just to be clear – it's not about github, I get "bad request" as response which ever webpage I try to request – google, yahoo, example.com. I also tried sending a request to my own webserver where I can check the access log, and it says the same there. In fact, this is all it says: |
Is that the exact copy-paste from your access logs? Having a comma instead of a period as the decimal separator in the HTTP version looks super suspect. If that is what is being send, it is pretty obvious servers are responding with Bad Requests. Could you try checking that you are using curl and not fsockopen as the transport? I think there may be a bug in fsockopen that makes it locale dependent… (If you have a locale set that uses commas for rendering floating point numbers, those will be used in the HTTP line.) |
Sorry, I can't offer support on this repo. |
Why was this closed? This is a valid bug. There's a good PR associated with it. |
Apologies, was too quick with my closing of issues. |
I just got started with Requests, using it with php5.6.
For some reason I get the response "Bad request" (400) on every GET and POST request I try.
I've tested this:
$response = Requests::get('https://github.com/timeline.json');
with a number of URLs and they do respond (I get a github page) but they all say "Bad request" (400).
Tried with POST as well, the example in the docs:
$url = 'https://api.github.com/some/endpoint';
$headers = array('Content-Type' => 'application/json');
$data = array('some' => 'data');
$response = Requests::post($url, $headers, json_encode($data));
var_dump($response->status_code);
But it also gives 400.
Sorry for the noob question, but where do I begin to find the cause for this?
Is it because I'm using php 5.6?
Thanks!
The text was updated successfully, but these errors were encountered: