studiosx Posted March 21, 2014 Share Posted March 21, 2014 I want to export videos, thumbs, duration, etc from my website into a xml format. I got this error:Invalid argument supplied forĀ foreach() $output .= ' <clips>'; if (!is_array( $vids )) { $vids = array( ); foreach ($imgs as $img) { $img = explode( '.', $img ); $vids[] = '0' . $img[0] . '.flv'; } } @sort( $vids ); @sort( $imgs ); $i = 38; foreach ($vids as $v) { $output .= ' <clip>'; $output .= ' <duration>' . $duration . '</duration>'; $output .= ' <width>' . $width . '</width>'; $output .= ' <height>' . $height . '</height>'; $output .= ' <flv>' . $v . '</flv>'; $output .= ' <screens> <screen>' . trim( $imgs[$i] ) . '</screen> </screens>'; $output .= ' </clip>'; ++$i; } $output .= ' </clips>'; Thank you! Quote Link to comment Share on other sites More sharing options...
gristoi Posted March 21, 2014 Share Posted March 21, 2014 chances are $imgs is not an array Quote Link to comment Share on other sites More sharing options...
studiosx Posted March 21, 2014 Author Share Posted March 21, 2014 What is that mean? I'm a beginner.Ā Quote Link to comment Share on other sites More sharing options...
jairathnem Posted March 21, 2014 Share Posted March 21, 2014 how is value stored to $imgs? do a var_dump($imgs) before the foreach loop and check if it holds any data. Quote Link to comment Share on other sites More sharing options...
studiosx Posted March 21, 2014 Author Share Posted March 21, 2014 XML Parsing Error: syntax error NULL ^ Quote Link to comment Share on other sites More sharing options...
jairathnem Posted March 21, 2014 Share Posted March 21, 2014 there is your problem. $imgs isn't holding any data. check how it is generated. Quote Link to comment Share on other sites More sharing options...
gristoi Posted March 21, 2014 Share Posted March 21, 2014 http://docs.php.net/manual/en/language.types.array.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.