Hello,

J'accède à une page web qui renvoie un json (inspection du code source ok).

Par contre quand je tente un file_get_contents, je récupère une erreur 400

Je ne comprends pas pourquoi. Auriez-vous une idée ?

Merci.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
<html>
HELLO
<?php
$json=file_get_contents('https://pageweb.php ');
var_dump( $http_response_header );
var_dump ($json);
$json_output = json_decode($json, true);
?>
</html>
Output:
Failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in