接收未定义的偏移量1

When user Login with facebook then i try to fetch their picture from facebook and upload it to my own website server but I'm Receiving error undefined offset 1, i don't know why I'm getting this error here is the code

$url = "https://graph.facebook.com/$fbid/picture?width=410&height=310"; //$fbid is the fbid of user //
$no = imd(); //  imd); is a function that generat random string //
$name = basename($url);
list($txt, $ext) = explode(".", $name);
$name = $txt.time();
$jo = ".jpg";
$name = $no.$jo;

$upload = file_put_contents("profile/upload/$name",file_get_contents($url));

$pic = $name;

As I have said in my comment above, the error is from list($txt, $ext) = explode(".", $name); because the result of explode is an array with only a single element on it array(1) { [0]=> string(28) "picture?width=410&height=310" }

You can simplify your code into this:

$url = "https://graph.facebook.com/$fbid/picture?width=410&height=310"; //$fbid is the fbid of user //
$no = imd(); //  imd); is a function that generat random string //
// $name = basename($url); // COMMENT THIS  since you have another assignment for this variable below
// list($txt, $ext) = explode(".", $name); // you didn't use $ext, and since we commented out the next line, $txt won't be used
// $name = $txt.time(); // COMMENT THIS  since you have another assignment for this variable below
$jo = ".jpg";
$name = $no.$jo;

$upload = file_put_contents("profile/upload/$name",file_get_contents($url));

$pic = $name;