file_get_contents($url) problem

i want dyanamic url should be called using
file_get_contents($url)

but i can able to that…

$url = “mylink.php?msg=$str&id=$uid”

where $uid and $str will get from the database

i tried $url = “web.com/post/xyz.php?msg=$str’&id='$uid’

but error occured as
"[function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home2/username/public_html/pqr/sms/responce.php on line 21

where line number 21 is file_get_contents($url);

You will need the scheme in your url.

$url = "http://mylink.php?msg=$str&id=$uid"

i have aready tried it…
but i got the error

Warning: file_get_contents(myurl?) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in
responce.php on line 23

where line num 23 is file_get_contents
in myurl , variable’s value is also repacing fine …

and if i copy the url in browser then it is working …

i did that then also i got the same error

actually if calls this function in

while($row = mysql_fetch_array($result){
file_get_contents} then it is not working…

and if i call this out side of this then it is working fine…

but my requirement is to call the funtion inside the mysql_fetch_array()

and note one thing that the variable are replacing fine…
but problem is occuring due to variable only…
because if i dnt use variables then only it is working


// Not Working
	$str = "download moblileji now";
	$url = "myurl .php?message=$str";
	$string = file_get_contents($url);
	echo $string;
	
	// Working
	$url = "myurl .php?message=download moblileji now";
	$string = file_get_contents($url);
	echo $string;
	
// Actually i want to do this
// and not working
	$sql_advt = "select * from table ";	  	
	$sql_result_advt = mysql_db_query (CELLMAGIX_DB_DBNAME, $sql_advt, $cma_connection) or die(mysql_error());
	while($row = mysql_fetch_array($sql_result_advt)){
			
			$str= "$row[mesage]";
			$url = "myurl .php?message=$str";
			$string = file_get_contents($url);
			echo $string;
		}

I added a urlencode() to ensure your string is properly escaped, and your first example in the previous post works fine. This may solve your problems.

<?php

$str = urlencode("download moblileji now");
$url = "http://myurl/myfile.php?message=$str";
$string = file_get_contents($url); 
echo $string;

See http://au.php.net/manual/en/function.urlencode.php

thanks …
now every thing is working fine…