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_

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

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
Programming Languages

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


Programming Languages

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
Web Design

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

Programming Languages
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-
PHP

- Technology - Languages
+ Webmasters
+ Development
+ Development Tools
+ Internet
+ Mobile Programming
+ Linux
+ Unix
+ Apple
+ Ubuntu
+ Mobile & Tablets
+ Databases
+ Android
+ Network & Servers
+ Operating Systems
+ Coding
+ Design Software
+ Web Development
+ Game Development
+ Access
+ Excel
+ Web Design
+ Web Hosting
+ Web Site Reviews
+ Domain Name
+ Information Security
+ Software
+ Computers
+ Electronics
+ Hardware
+ Windows
+ PHP
+ ASP/ASP.Net
+ C/C++/C#
+ VB/VB.Net
+ JAVA
+ Javascript
+ Programming
Privacy Policy - Copyrights Notice - Feedback - Report Violation 2018 © BigHow