Hello, thank you very much, for exploring my (uncomented, sorry) code.
But both errors werent errors actually. I've written a long explanation yesterday, but the fucki'n storm has shut down electric network I will not wtire it so detailed again, sorry.
1. st error: parse_url returns array.
2 nd. error: There are an if(is_array(...)) statement.

But you've shared some usefull links for me, and I will try to use them and make the script another way.
So thank you for your time and for wishing me luck.