need help....combine strings

  • Scott123
  • Newbie
  • Newbie
  • Scott123
  • Posts: 10

Post 3+ Months Ago

Code: [ Select ]
 
$authcode="12345"
$nexturl="\"http://www.mysite.com/up-load.php?confirm=".$authcode."\"";
 
#This works
$get_content = file_get_contents("http://www.mysite.com/up-load.php?confirm=123456")
 
#This does not work
$get_content = file_get_contents($nexturl);
 
  1.  
  2. $authcode="12345"
  3. $nexturl="\"http://www.mysite.com/up-load.php?confirm=".$authcode."\"";
  4.  
  5. #This works
  6. $get_content = file_get_contents("http://www.mysite.com/up-load.php?confirm=123456")
  7.  
  8. #This does not work
  9. $get_content = file_get_contents($nexturl);
  10.  


why????

Help!!

:cry: Thanks.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

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.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 53 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.