Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

141
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda