PHP Trademark Search
function checkmarks($username){
//url encode the username to check
$username = urlencode($username);
//initialize curl
$curl = curl_init();
//create a url with the social username to check, api username, and api password
$url = "https://checkmarks.com/api/v1/username/{$username}/account/{$apiaccount}/password/{$apipassword}";
//set curl options
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//perform curl and return json decoded results
return json_decode(curl_exec($curl));
}
//get response from service
$response = checkmarks($username);
//loop through returned websites
foreach($response as $website){
$websitename = $website->website;
$usernamestatus = $website->status;
//set $facebook, $twitter, etc. variables equal to status
//0 = username not available, 1 = username available
$$websitename = $usernamestatus;
}
var_dump($facebook);
var_dump($twitter);
var_dump($instagram);
var_dump($snapchat);
var_dump($youtube);