I need to get the keyword what user's searched in the google search engine. I tried http_referer in php but got only the origin not the full url and keyword. Kindly share some idea about.
Unfortunately, you can't. I've looked into this in the past.
HTTP_Referer is only compatible with http addresses. Https addresses do not pass referer data because they are httpsecure.
Google traffic is coming from https://google.com and therefore it does not pass the HTTP_Referer PHP parameter data.
I wish this wasn't the case.
You can get a pretty accurate view of what keywords users are coming to your site by looking at Webmaster search console.