Search code examples
phphead

How to handle HEAD request?


I have got request like this :

7327    xxxxxxx [26/Jul/2015:21:50:10 +0200]    -   200 www.xxx.xx"HEAD /dokonceniPlatby.php?merchantId=374&accountId=402&value=50.00&currency=CZK&methodId=1&description=N%C3%A1kup+zbo%C5%BE%C3%AD+v+na%C5%A1em+e-shopu&merchantData=2067&status=2&paymentId=91882&ipRating=&isOffline=0&needConfirm=1&isConfirm=1&signature=xxxxx HTTP/1.1"

How can i get these values like merchantId, or accountId?


Solution

  • Where you have this data ? try :

    echo $_GET['merchantId'];  // or
    echo $_REQUEST['merchantId'];
    

    Otherwise you can get it with parse_str :

    $str = "first=value&arr[]=foo+bar&arr[]=baz";
    parse_str($str, $output);
    echo $output['first'];  // value
    echo $output['arr'][0]; // foo bar
    echo $output['arr'][1]; // baz