I am getting an warning messsage like this
Warning: file_get_contents() [function.file-get-contents]: stream does not support seeking
this is the code
$f=file_get_contents('https://api.facebook.com/method/stream.publish?message='.$facebook_message1[0].'%20'.$facebook_message1[1].'%20'.$facebook_message1[2].'%20'.$facebook_message1[3].'%20'.$facebook_message1[4].'%20'.$facebook_message1[5].'%20'.$facebook_message1[6].'%20'.$facebook_message1[7].'%20'.$facebook_message1[8].'%20'.$facebook_message1[9].'%20'.$facebook_message1[10].'%20'.$facebook_message1[11].'%20'.$facebook_message1[12].'%20'.$facebook_message1[13].'%20'.$facebook_message1[14].'%20'.$facebook_message1[15].'%20'.$facebook_message1[16].'%20'.$facebook_message1[17].'%20'.$facebook_message1[18].'%20'.$facebook_message1[19].'%20'.$facebook_message1[20].'&attachment={"name":"'.$url.'","href":"'.$url.'","caption":"","description":"","media":[{"type":"image","src":"'.$facebook_image.'","href":"'.$cat.'"}]}&uid='.$user_id.'&access_token='.$access_token.'', NULL, NULL, 246);
$fID = substr_replace($f,"",-27);
Your immediate problem is that you are using the fourth parameter of
file_get_contents
. You should simply omit that and cut off the relevant part of$f
withsubstr
later, like this:However, there are many other issues:
$facebook_message
is atrocious. Save your sanity and useimplode('%20', $facebook_message)
instead of the manual string concatenation.246
and-27
in your code. How did you produce these values? Obviously they refer to a part of the result string delimited by something, so document that by writing code that finds the delimiters. Your current code will break the moment facebook does any small change to their return value format, even if that change is purely technical and makes no difference from a semantic point of view.