Hello

I want to get response or content of a url..!!!

$url="http://203.142.18.33:4480/3030service/airtel.php?mobile=".$mobile."&msg=".$msg."&from=".$from;
  $file=file($url) ;
  print_r($file);

but i got an error [function.file]: failed to open stream: HTTP request failed- Response of the file..!!

with file_get_contents it showing same error..!!

is there any method other to get the response..!!
with
thank u.!

Hello

I want to get response or content of a url..!!!

$url="http://203.142.18.33:4480/3030service/airtel.php?mobile=".$mobile."&msg=".$msg."&from=".$from;
  $file=file($url) ;
  print_r($file);

but i got an error [function.file]: failed to open stream: HTTP request failed- Response of the file..!!

with file_get_contents it showing same error..!!

is there any method other to get the response..!!
with
thank u.!

What you have paste here - " failed to open stream: HTTP request failed- Response of the file..!!" is a server response.

Please paste complete error message.

What you have paste here - " failed to open stream: HTTP request failed- Response of the file..!!" is a server response.

Please paste complete error message.

file([url]http://203.142.18.33:4480/3030service/airtel.php?mobile=xxxxx&msg=xxxx&from=xxxx[/url]) [function.file]: failed to open stream: HTTP request failed! [U][I]Hello how r u..?[/I].[/U] in C:\xampp\htdocs\sms\sms1.php on line 8

Underlined text is a Message or Response or Content of a Url..!!

if i run url directly on browser than it perfectly showing the content..!!

but using php it throwing error..!! :(

thnx for quick response

Hi.

Have you made sure your server allows URLs to be used to get data like that?
Try this:

<?php
    header("content-type: text/plain");
    echo "fopen  : ", (ini_get('allow_url_fopen') ? "TRUE" : "FALSE"), "\n";
    echo "include: ", (ini_get('allow_url_include') ? "TRUE" : "FALSE"), "\n";
?>

If both are FALSE, then your server doesn't allow this.
If only fopen is TRUE, then you should be able to use the file or file_get_contents (and obviously fopen ) functions to open URLs.

In that case, there is something else going on.
Try printing the exact URL being used, see if it is somehow malformed after being manipulated by PHP.

Hi.

Have you made sure your server allows URLs to be used to get data like that?
Try this:

<?php
    header("content-type: text/plain");
    echo "fopen  : ", (ini_get('allow_url_fopen') ? "TRUE" : "FALSE"), "\n";
    echo "include: ", (ini_get('allow_url_include') ? "TRUE" : "FALSE"), "\n";
?>

If both are FALSE, then your server doesn't allow this.
If only fopen is TRUE, then you should be able to use the file or file_get_contents (and obviously fopen ) functions to open URLs.

In that case, there is something else going on.
Try printing the exact URL being used, see if it is somehow malformed after being manipulated by PHP.

You'd actually get a different error if allow_url_fopen was set to false.

The url cannot be accessed in a browser:
http://203.142.18.33:4480/

Are you sure the URL is working? Unless they only allow certain IPs to connect to that port, the URL is down.

This article has been dead for over six months. Start a new discussion instead.