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
9,409 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.

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,095 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,840 points
37,061 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,840 points
2,786 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 PHP by narikkadan
• 63,600 points
1,182 views
0 votes
0 answers

Does the string "php?id=1" within a http GET request mean there is necesseraly an sql request to a back-end database?

You can use Google dorks like "inurl:.php?id=" ...READ MORE

Aug 6, 2022 in PHP by Kithuzzz
• 38,000 points
2,942 views
0 votes
1 answer

Trying to call AWS API via PHP

Try using AWS SDK for PHP, Link ...READ MORE

answered Jun 6, 2018 in AWS by Cloud gunner
• 4,670 points
1,742 views
0 votes
1 answer

How to use Blockchain receive API without exchange rate?

Your code contains the amount in USD ...READ MORE

answered Aug 21, 2018 in Blockchain by Perry
• 17,100 points
887 views
0 votes
1 answer

Setting a Custom SEO Title Using Yoast Wordpress SEO API

Firstly disable WordPress SEO by Yoast, then ...READ MORE

answered Mar 11, 2022 in Digital Marketing by narikkadan
• 63,600 points
1,197 views
0 votes
1 answer

Currency Conversion using PHP

 An example of converting EUR to USD ...READ MORE

answered Mar 24, 2022 in Blockchain by Rahul
• 9,680 points
499 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP