PHP file get contents returns failed to open stream HTTP request failed

0 votes

I'm having trouble using PHP code to call a URL. I have to use my PHP code to call service using a query string. When I use file-get-contents() to perform the call, I receive the following result instead of the expected one when I type the URL into a browser:

Warning: file-get-contents(http://.... ) failed to open stream: HTTP request failed! HTTP/1.1 202 Accepted in ...

The code I am using is:

$query=file_get_contents('http://###.##.##.##/mp/get?mpsrc=http://mybucket.s3.amazonaws.com/11111.mpg&mpaction=convert format=flv');
echo($query); 

I have also tried with other URLs such as:

$query=file_get_contents('http://www.youtube.com/watch?v=XiFrfeJ8dKM');

This works fine... could it be that the URL I need to call has a second http:// in it?

Jul 28, 2022 in PHP by Kithuzzz
• 38,000 points
10,176 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
dzieki za pomoc
answered Nov 26, 2022 by anonymous

edited Mar 5
0 votes
dgdsagdsgdsgdsgdsgdsg
answered Dec 9, 2022 by Krrrrreeee

edited Mar 5

Related Questions In PHP

0 votes
0 answers

PHP - Failed to open stream : No such file or directory

In PHP scripts, when I call include(), require(), fopen(), or ...READ MORE

May 16, 2022 in PHP by Kichu
• 19,040 points
7,493 views
0 votes
0 answers
0 votes
1 answer

Error:Failed to open stream : No such file or directory.

Hello @kartik, Go to the file to include ...READ MORE

answered Oct 1, 2020 in PHP by Niroj
• 82,800 points
38,557 views
0 votes
1 answer

How to get the http headers from current request in PHP?

Hello, Try this code: if (!function_exists('getallheaders')) { ...READ MORE

answered Nov 23, 2020 in PHP by Niroj
• 82,800 points
3,389 views
0 votes
0 answers

file_get_contents("php://input") or $HTTP_RAW_POST_DATA, which one is better to get the body of JSON request?

The file_get_contents("php://input") or $HTTP_RAW_POST_DATA - which one ...READ MORE

Jun 23, 2022 in