-1

Below is the my curl for senting some parameters to a url.But the parameter I m senting has sensitive datas like passwords and other things.But during posting the datas will be showed in the adress bar as redirect url.How to avoid this?.What to do to sent data without showing it in address bar?

$parameters='MerchantId='.$merchantId.'&Password='.$Password.'&ReferenceNo='.$ReferenceNo.'&RemoteIP='.$RemoteIP.'&Amount='.$Amount.'&BankId='.$BankId.'&Checksum='.$checksum.'&Name='.$Name.'&MobileNo='.$MobileNo.'&Email='.$Email;
    //set POST variables
    $url = 'https://payment.essecom.com/NetBanking/PayDirekt.jsp?'.$parameters;
    //header('Location: '.$url);
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/plain', 'Content-length: 900'));
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    echo curl_exec($ch);
    curl_close($ch);
}

1 Answer 1

1

It's pretty easy to not include headers in output. Just add option CURLOPT_HEADER and set it to false. But without headers how can you be sure that request is completed successfully?

5
  • It will get redirected to a response url.I tried adding curl_setopt($ch, CURLOPT_HEADER,true);,but the datas are still shown in the adress bar
    – Ajeesh
    Dec 1, 2013 at 12:34
  • sorry, you should set it the opposite - to false :)
    – mente
    Dec 1, 2013 at 12:37
  • cellpay.essecom.com/NetBanking/… this is the way it is shown in the adress bar,but cant hide this,i have set the option as false,but still :(
    – Ajeesh
    Dec 1, 2013 at 12:40
  • Well, that's totally different question and doesn't relate anyhow to curl or PHP itself. You want to hide redirect (btw that is not reflected in question) and GET parameters from user. Can you update your question to let others understand what you really need?
    – mente
    Dec 1, 2013 at 12:43
  • well, you can handle redirect internally on server and show to user only when sensitive data is already hidden
    – mente
    Dec 1, 2013 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.