Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6840737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:52:49+00:00 2026-05-26T23:52:49+00:00

I have a question about & symbol: I have an return url in this

  • 0

I have a question about “&” symbol:

I have an return url in this format:

http://localhost/index.php?task=payment_return&id=113&token=750ac376e9ee1f6e87eba80c409005c4

I set it to XML in my PHP function, inside “url-retorno”:

private function XMLUrlRetorno() {
    // $msg = '<url-retorno>' . $this->getData('url_retorno') . '</url-retorno>';
    $msg = '<url-retorno>' . str_replace('&', '&amp;', $this->getData('url_retorno')) . '</url-retorno>';
    return $msg;
}

Ok, but the problem is the “&”, if my url are written in this format:

http://localhost/index.php?task=payment_return&id=113&token=750ac376e9ee1f6e87eba80c409005c4

Or

http://localhost/index.php?task=payment_return&amp;id=113&amp;token=750ac376e9ee1f6e87eba80c409005c4

I get this error from XML:

error: Unexpected end of file after url-retorno

I have tried with htmlspecialchar, with str_replace(‘&’, ..) and again error..

What to do, if ‘url-retorno’ have not “&” it’s working propertly, but if have, not?

The XML send:

<?xml version="1.0" encoding="ISO-8859-1"?>
<requisicao-transacao id="c1303587fb566fdec7ae480f5b8d3e04" versao="1.1.0">
  <dados-ec>
    <numero>0000000000</numero>
    <chave>a00000000a0000000000a0000000aa0000a0000000000a0aaa0a0000aa0aa000</chave>
  </dados-ec>
  <dados-pedido>
    <numero>185</numero>
    <valor>15</valor>
    <moeda>986</moeda>
    <data-hora>2011-11-20T13:57:51</data-hora>
    <descricao>185 - teste: 1 x $15.00</descricao>
    <idioma>PT</idioma>
  </dados-pedido>
  <forma-pagamento>
    <bandeira>visa</bandeira>
    <produto>1</produto>
    <parcelas>1</parcelas>
  </forma-pagamento>
  <url-retorno>http://localhost/index.php?task=payment_return&amp;id=185&amp;token=4babfe87206d14cc88220810d44bbb28</url-retorno>
  <autorizar>3</autorizar>
  <capturar>1</capturar>
</requisicao-transacao>

The XML response:

<?xml version="1.0" encoding="ISO-8859-1"?>
<erro xmlns="http://ecommerce.cbmp.com.br">
  <codigo>001</codigo>
  <mensagem>XML inválido: 'error: Unexpected end of file after url-retorno'.</mensagem
</erro>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:52:50+00:00Added an answer on May 26, 2026 at 11:52 pm

    Just use the cdata tag in your xml

     <![CDATA[
           Your url with & in it
         ]]>
    

    This should look like this in your code and is totally xml conform.

        private function XMLUrlRetorno() {
            $msg = '<url-retorno><![CDATA[' . $this->getData('url_retorno') . ']]></url-retorno>';
            return $msg;
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following rule in htaccess: RewriteRule ^([a-zA-Z0-9\-\_]+)/?$ test.php?&url=$1 [L] My question is
I have a question about locking. This doesn't have to be only about record
I have a question about using new[] . Imagine this: Object.SomeProperty = new[] {string1,
I have a question about this question . I posted a reply there but
I'm new to Oracle 11g & I have a question about a query. I
This question is about functional programming, not about how to build URL query strings.
I have a question about Qt & network sockets. If I have a computer
I have several question about integrating integrating Doctrine 2.2 & Zend framework. I know
I have a question about RAD & WAS Spring MVC development. So that we
I have some question about behavior of std::async function with std::launch::async policy & std::future

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.