Skip to content

Instantly share code, notes, and snippets.

@nailton
Created April 30, 2019 18:18
Show Gist options
  • Save nailton/72e92ad4cf0ed7e154500fa0b551a9da to your computer and use it in GitHub Desktop.
Save nailton/72e92ad4cf0ed7e154500fa0b551a9da to your computer and use it in GitHub Desktop.
Display URL WEB/API
<?php
// Verificar se é mobile
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
$berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");
if ($iphone || $android || $palmpre || $ipod || $berry == true)
{
/* Habilitar diferente URL do WhatsApp conforme o dispositivo,
devido ao whatsapp não reconhecer no browser/mobile a mesma url, dá problemas.
*/
// Mobile
$url_whatsapp = "api.whatsapp.com";
}else{
// Desktop
$url_whatsapp = "web.whatsapp.com";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment