Whats wrong with this code?

Discussion in 'PHP' started by dawilster, Jun 25, 2009.

  1. #1
    		elseif($curtag == 'URL')
    			$y_link = htmlentities($data, ENT_QUOTES, 'UTF-8' );
    Code (markup):
    For some reason when the xml data it pulls has a symbol such as "&" it seems to mess up the final data, can anyone please help me so it doesn't do that anymore.

    Basically whenever the data is
    http://www.domain.com/computer&something.htm

    it pulls everything after the "&" so it ends up being something.htm

    How can i make it retrieve the entire url?

    Thanks a lot
     
    dawilster, Jun 25, 2009 IP
  2. pipisdicelana

    pipisdicelana Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    why are you using htmlentities for url?
     
    pipisdicelana, Jun 25, 2009 IP
  3. dawilster

    dawilster Active Member

    Messages:
    844
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #3
    so should i remove it?
     
    dawilster, Jun 26, 2009 IP
  4. credobyte

    credobyte Peon

    Messages:
    38
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Instead of htmlentities, use urlencode ( tough, I don't see a reason why you should touch these functions ) :
    $link = urlencode($data);
    PHP:
     
    credobyte, Jun 26, 2009 IP