Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

142
Visualizações
http_build_query ignore one key

I've a URL which becomes a query string with the http_build_query function.

But I have a parametertimestamp which I cannot edit. And &times becomes a multiplication sign x.

Is there a workaround for this?

This is my array which gets passed to the http_build_query function.

$parameters =   array(
            "transaction_id"=>uniqid("FF-"),
            "timestamp"=> time(),
            "order_total"=>$_SESSION['total_price'],
            "order_total_with_vat"=>$_SESSION['total_price'] * 1.21,
            "order_vat"=>"21",
            "payment_method"=>"ideal",
            "payment_status"=>"1",
            "customer_name"=>$_SESSION['customer_data']['naam'],
            "customer_address"=>$_SESSION['customer_data']['address'],
            "customer_city"=>$_SESSION['customer_data']['city'],
            "customer_zipcode"=>$_SESSION['customer_data']['zipcode'],
            "customer_country"=>$_SESSION['customer_data']['country'],
            "customer_email"=>$_SESSION['customer_data']['email'],
            "customer_telephone"=>$_SESSION['customer_data']['telephone'],
        );

Output of url:

http://somedomain/subdir/someapi/order?transaction_id=FF-58e2451c5aea9×tamp=1491223836&order_total=156695&order_total_with_vat=189600.95&order_vat=21&payment_method=ideal&payment_status=1&customer_name=t&customer_address=t&customer_city=t&customer_zipcode=t&customer_country=t&customer_email=t%40t&customer_telephone=t&product%5B0%5D=5&product%5B1%5D=5&product%5B2%5D=5&product%5B3%5D=5&product%5B4%5D=5&product%5B5%5D=5&product%5B6%5D=5

Preffered output:

http://somedomain/subdir/someapi/order?transaction_id=FF-58e2451c5aea9&timestamp=1491223836&order_total=156695&order_total_with_vat=189600.95&order_vat=21&payment_method=ideal&payment_status=1&customer_name=t&customer_address=t&customer_city=t&customer_zipcode=t&customer_country=t&customer_email=t%40t&customer_telephone=t&product%5B0%5D=5&product%5B1%5D=5&product%5B2%5D=5&product%5B3%5D=5&product%5B4%5D=5&product%5B5%5D=5&product%5B6%5D=5

http_build_query function:

case 'POST':
    curl_setopt( $curlHandler, CURLOPT_POST, true );
    $url    .= '?' . http_build_query( $parameters );
    break;
about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Currently it is working correctly. The issue is that when you echo your URL the sequence &times will make your browser replace it with the multiplication symbol x. To echo it and show the correct way in the browser try this:

echo htmlspecialchars($url); 

This will display the desired URL.

about 4 years ago · Santiago Trujillo Relatório

0

@Novice was right, he commented on my question:

It's just a display issue in browser but your curl data will go just like what you have shown in your preffered output , no need to add anything extra just hit and go! – Novice

When I checked the apache access.log I could see the preffered query string posted.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda