Closed HardSoftMac closed 5 years ago
Hi, the error message says what the error is. You try to print out $clientInfo as a string, but $clientInfo is not a string, but an array. If you want to view the whole content of the array, try print_r() or var_dump().
Thank you for the response. I got these:
Array ( [type] => browser [name] => Chrome [short_name] => CH [version] => 72.0 [engine] => Blink [engine_version] => ) Array ( [name] => Windows [short_name] => WIN [version] => 10 [platform] => x64 )
What I actually want is to save the these information into database and later output in login history as in http://devicedetector.net/
I need name and version to join together: 'name' => string 'Chrome' 'version' => string '72.0' to form: Chrome 72.0
'name' => string 'Windows' 'version' => string '10' to form: Windows 10
Please help.
Hi, this is a general programming question and not a bug in device-detector. Please ask on Stackoverflow or the Matomo forum. Also include more details on your setup as it totally depends on what you are programming
I'm so sorry. I figured it out. Thank you. If you can delete this entire thread, that will be nice. After all, it's not a bug issue.
Hello developer,
I installed through Composer. Now I'm having trouble echoing the variable out.
I have this on top of my page:
`require_once 'vendor/autoload.php';
use DeviceDetector\DeviceDetector; use DeviceDetector\Parser\Device\DeviceParserAbstract;
//DeviceParserAbstract::setVersionTruncation(DeviceParserAbstract::VERSION_TRUNCATION_NONE);
$userAgent = $_SERVER['HTTP_USER_AGENT']; // change this to the useragent you want to parse
$dd = new DeviceDetector($userAgent);
$dd->parse();
if ($dd->isBot()) { // handle bots,spiders,crawlers,... $botInfo = $dd->getBot(); } else { $clientInfo = $dd->getClient(); // holds information about browser, feed reader, media player, ... $osInfo = $dd->getOs(); $device = $dd->getDeviceName(); $brand = $dd->getBrandName(); $model = $dd->getModel(); }`
And my inputs:
`
Please help
NOTE: When I removed: //$clientInfo = $dd->getClient(); // holds information about browser, feed reader, media player, ... //$osInfo = $dd->getOs();
no error but only $device = $dd->getDeviceName(); echoed out. Others blank.