Home > Blockchain >  Failed to open stream: HTTP request failed! HTTP/1.1 when use file_get_contents
Failed to open stream: HTTP request failed! HTTP/1.1 when use file_get_contents

Time:10-01

when I use file_get_contents function I get Failed to open stream: HTTP request failed! HTTP/1.1 502 Bad Gateway in xammp/...

$name = $_GET['name'];
$phone = $_GET['phone'];
$price = $_GET['price'];
$residue = $_GET['residue'];

file_get_contents("http://example.com:8080/?apikey=***********=&pid=*********&fnum=*******&tnum=$phone&p1=name&p2=price&p3=residue&v1=$name&v2=$price&v3=$residue");

CodePudding user response:

Failed to open stream means the target file was not located. Either the server responded with a 404 HTTP Status or the file is missing.

Use the proper URL Ensure your API Keys are still valid with server you're requesting to.


You can copy the URL to a browser and see the response from there.

  • Related