Arguments only need quotes around them when they're being passed as string literals. When you pass a variable name instead of a string literal, for example passing $nexturl instead of "http://...", the contents of that variable do not need to include quotes.

So where you're including escaped double quotes like \", the function you're passing the argument to considers that first quote the first character of the argument instead of the "h" from http:// like it wants.