0
I need to change the user agent on mobile. I tried with pure php but it didn’t work, I’m using Mobile Detect, I can even detect when it’s mobile, but I can’t change the user agent.
The example I followed was this
if(!$detect->isMobile()) {
$userAgent = 'BlackBerry7100i/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/103';
$detect->setUserAgent($userAgent);
echo $_SERVER['HTTP_USER_AGENT'] . "<hr />\n";
}
What is wrong?
It worked out Victor, but he still doesn’t bring the whole desktop version. What should I do? Record a cookie, a session and reload the page? I need to mimic the same "Request desktop site" function in Chrome for mobile. $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (X11; Linux x86_64) Applewebkit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36';
– Leonardo