How to fix php Warning: file_get_contents?failed to open stream: HTTP request failed


HOME » PHP

How to fix php Warning: file_get_contents?


Warning: file_get_contents(http://192.168.1.254:9999/api/p/internal/ucenter/login?loginName=test102&password=111111) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /Applications/XAMPP/xamppfiles/htdocs/PHP_test/index.php on line 49

Here is code related to $files:


<?php
$loginNames="test102";
$passwords="111111";
$apiUrl = "http://192.168.1.254:9999/api/p/internal/ucenter/login?loginName=".$loginNames."&password=".$passwords;
$callback = file_get_contents($apiUrl);
print_

Related to : How to fix php Warning: file_get_contents?failed to open stream: HTTP request failed
How to fix php Warning: file_get_contents?failed to open stream: HTTP request failed
PHP

How to fix php Warning: file_get_contents?


Warning: file_get_contents(http://192.168.1.254:9999/api/p/internal/ucenter/login?loginName=test102&password=111111) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /Applications/XAMPP/xamppfiles/htdocs/PHP_test/index.php on line 49

Here is code related to $files:


<?php
$loginNames="test102";
$passwords="111111";
$apiUrl = "http://192.168.1.254:9999/api/p/internal/ucenter/login?loginName=".$loginNames."&password=".$passwords;
$callback = file_get_contents($apiUrl);
print_
PHP failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request (xml)
PHP

I am trying to get the xml data from a remote site.


The host states that "you will need to request both Gzip and Deflate compression methods in any software you develop". You also need to pass username and password in call.


I am trying to do this with the following code and show the results but it is not working. What am I doing wrong?


$opts = array(
'http'=>array(
'method'=>"GET",
'Accept-Encoding'=>"gzip, deflate"
)
);
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
$file = file_get_contents('http://u
php fopen: failed to open stream: HTTP request failed! HTTP/1.0 403
PHP

I am receiving an error message in PHP 5 when I try to open a file of a different website. So the line


fopen("http://www.domain.com/somef­ile.php", r)

returns an error


Warning: fopen(www.domain.com/somefile.php) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in D:xampphtdocsdestroyfilesindex.php on line 2



FQL error 'failed to open stream failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error in '
PHP

I am 2 facebook accounts.
I use one for testing (has 600 friends) and other for development (5 friends). I am trying get all the ids of a users friend using the code


function get_photo($access_token){
// Run fql query
$fql_query_url = 'https://graph.facebook.com/'
. '/fql?q=SELECT+pid+,object_id+,owner+FROM+photo+WHERE+owner+=+me()+OR+owner+IN+(SELECT+uid2+FROM+friend+WHERE+uid1+=+me())+LIMIT+50'
. '&access_token=' . $access_token;
// First logically check the result, TRUE: Result is passed to $fql_query_result.
// FALSE: $flq_query_result = 0 or false.
$f
Warning: file_get_contents () failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in
PHP

I don't know why but I always got this error when I want to get PHP data with file_get_contents.


I have checked my PHP.ini and allow_url_fopen is: ON so that couldn't be the problem.


Here is the code I'm using:


$id='54352';
$url='http://www.google.com';
$data = file_get_contents('http://www.####.###/###.php?id='.$id.'&url='.urlencode($url));
var_dump $data;

I don't know what is going on here, I just get this error message and the value: bool(false).


I have also tried cURL, but it doesn't return ANY value to me...


Can anyone pleas

GAE, PHP and GCM: failed to open stream: HTTP request failed! HTTP/1.0 405 Method Not Allowed
PHP
I'm developing a web application (using GAE for PHP) that notifies android clients (via GCM - Google Cloud Messaging) when some content are available for download.The following PHP script should do job:$json = array( 'data' => array( ... ), 'registration_ids' => array( ... ));$data = json_encode( $json );$context = array( 'http' => array( 'method' => 'post', 'header' => 'Authorization: key=MY_SECRET_KEY' . "" . 'Content-

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .