Not only easy ones like .com or .net, but also, .co.uk, .fr, .gov.rw ... ?
Should I really make a huge mapping "tld to relevant whois server", or is there an easier way ?
http://php.net/manual/en/function.checkdnsrr.php
if (checkdnsrr('test.nl', 'A')) // or use ANY or for other see above link
{
echo 'Domain exists';
}
else
{
echo 'Domain does not exist';
}
http://whois.net/ any good?
PHP:
$URL = "http://www.dotnetindex.com/articles/5261-Article--AJAX-Tips-and-Tricks.asp";
$PARSED_URL = parse_url($URL);
$DOMAIN = $PARSED_URL['host'];
$ip = gethostbyname($DOMAIN);
if($ip===$DOMAIN)
{
echo "Url does not exist";
}
else
{
echo "Url exists";
}
Do you want to know if the domain is registered, or if it's actually present in the DNS ?
If the former, then whois based approaches are the only viable way, and even then you'll run into massive issues parsing the highly varied output from the various TLDs whois servers.
If the latter, a simple DNS lookup will suffice.
You may have to try different services:
This one seems to work for a lot more than the standard Whois:
http://whois.domaintools.com/
Works for .co.uk and .fr as well as the standard ones
Related
I'm pretty stuck and can't find anything about it on the internet. I'm also not sure how to describe the thing i'm looking for, so maybe someone can help me.
I've got some code to create a ticket in TopDesk through API using invoke-restmethod in PS.
For the request field in TopDesk, I need some output stored in a variable, but if I want to use a variable in the PS command, I need to define the JSON body with the use of #{} | covertTo-JSON (found that somewhere on the internet).
Now this parameter I need to put through, has to have a definition. I need to give in in the value is a email or a name.
$json = #{
"callerLookup" = "{ email : email#domain.com }"
} | Convertto-JSON
Now the thing is, TopDesk doesn't see the "{ email : email#domain.com }" as a correct value.
Before, I just the following (which will work, but can't use variables):
$body = '{"email": "automation#rid-utrecht.nl"}'
I hope I described my problem cleary enough and hope that someone can help me.
Thanks in advance.
Kind regards,
Damian
For ConvertTo-Json to produce the serialized { "property" : "value" } syntax, you must pass it an object that has a property called property and an associated value equal to value. You can easily create this scenario with the [pscustomobject] accelerator.
$json = #{
callerLookup = [pscustomobject]#{email = 'email#domain.com'}
} | ConvertTo-Json
I have the following code
log(config.render())
However if I have passwords in the config then they'll appear in log. Is there easy way to eliminate this? I am looking for something like that
log(config.map { if ("password" in it.key.toLowerCase()) "***" else it.value }
.render())
For now the only clear solution is to do like this
val contentHiddenValue = ConfigValueFactory.fromAnyRef("***", "Content hidden")
log.info(config.root()
.withoutKey("security")
.withValue("security", contentHiddenValue)
.render())
The obvious disadvantage is that it hides only exact config subtree
I am looking to add a line(s) into a PowerShell script. I want to get my script to check if something exists in a CSV it will give a true/false response.
Basically I have a script to remove user access from O365 and AD including and mailbox changes.
My company also uses a lot of external portals which need removing manually.
I would like it to check the $EmailAddress input against CSV's (i.e DomainHostAccess.CSV, WebsiteHostAccess.CSV, SupplierAccess.Csv) then if there name is in the list it will output something similar to;
DomainHostAccess | True
WebsiteHostAccess | False
SupplierAccess | True
that way we know that we need to manually log into these services and remove accounts.
I have looked on the posts on here already and couldn't find anything suitable, I am fairly new to PS and this is a little advance for me so I would appreciate any help that can be given.
You could try something like this
$UserList = Import-Csv -Path C:\EmailAddress.CSV
$UserData = Import-Csv -Path C:\DomainHostAccess.CSV
ForEach ($Email in $UserList)
{
$userMatch = $UserData | where {$_.Name -like $Email.Name}
If($userMatch)
{
Write-host $Email.Name "Domain Access True"
}
Else
{
Write-host $Email.Name "Domain Access False"
}
}
You would need to have headers on your CSVs for this check to work.
I try to search long and hard to find my answers and almost never ask questions if I can help it. but it's 5am and I've been working on this project for quite a few months now and I'm stuck.
THE PROBLEM
I have a JSON file saved on my local server which has the following layout:
*Note I've cut down the JSON file to remove the bloat and focus on exactly what I'm trying to extract here.
{
"count": 74,
"results": [
{
"listing_id": 151323205,
"Images": [
{
"url_75x75": "https:\/\/img1.etsystatic.com\/013\/0\/7566894\/il_75x75.459599049_hptl.jpg",
},
]
}
],
"params": {
"limit": "1",
"shop_id": "username",
},
}
THE CODE
Now I've managed to iterate through all the other stuff like 'listing_id' & 'Images' but it appears the 'shop_id' is outside of the scope of my foreach command and inside the 'params' portion?
foreach($results->results as $product){
$products[$i]['url_75x75'] = $product->Images[0]->url_75x75;
$i++;
}
I'm not super PHP savvy so If you can dumb it down just a bit? It's probably something very simple for you guys and I'd like to learn what I'm doing wrong and how to do it right.
This isn't the full code like I stated so if you need more insight please ask. I didn't want to bombard people with a bunch of my keyboard slapping coding skills :)
Thank you so much! I love SO!
You should be able to get the shop id with the following code:
$shop_id = $results->params->shop_id;
You can use this inside the foreach loop if you want to (though its value will not change of course).
$results is probably your whole object, which contains all the data that was in the JSON. $results->results reads only the "results" part inside the JSON, so the loop only iterates over what is in there.
To read the shop id, you can just read:
echo $results->params->shop_id;
Params is on the same level as results so in your for each where you are looking at $results->results, you are not including params, you can nest your for each like
Foreach ($results as $result) {
Foreach ($result->results){}
Foreach ($result->params){}
}
Earlier I asked about gathering information from API-Link, and I have managed to get out most of the details by using the answar I got.
Now ny problem is when another API to get more information
This time the file will contain this information:
{
"username":"UserName",
"confirmed_rewards":"0",
"round_estimate":"0.00000000",
"total_hashrate":"0.000",
"payout_history":"0",
"round_shares":"0",
"workers":{
"UserName.1":{
"alive":"0",
"hashrate":"0.000"
},
"UserName.2":{
"alive":"0",
"hashrate":"0.000"
},
"UserName.3":{
"alive":"1",
"hashrate":"1517.540",
"last_share_timestamp":1369598007
},
"UserName.4":{
"alive":"0",
"hashrate":"0.000"
}
}
}
And I want to gather each of the workers and print them out. This "workers" could contain multiple information, but always start with "UserName.x", where the username come from the "username" paramter each time.
The numbers will always vary from 0 and up
I want to gether the information in the same way by accessing the document, and decode and print out all the workers, whatever the numbers of them are.
By using the script provided in my last question(look at the link in the start), i was thinking that it would be something like
local t = json.decode( txt )
print("Workers: ".. t["workers.UserName.1"])
But this was not the way.
Due to the username changing all the time, I was also thinking somthing like
print("Workers: ".. t["workers" .. "." .. "username" .. "." .. "1"])
From here I have no clue about how I should gather the information, even when the names and numbers vary
Thanks in advance
Here is the perfect solution:
local json = require "json"
local t = json.decode( jsonFile( "data.json" )
local workers = t.workers
for name, user in pairs(workers) do
print("--------------------")
print(name)
for tag, value in pairs(user) do
print(tag , value)
end
end
Here are some more info:
http://www.coronalabs.com/blog/2011/08/03/tutorial-exploring-json-usage-in-corona/
http://www.coronalabs.com/blog/2011/06/21/understanding-lua-tables-in-corona-sdk/
http://lua-users.org/wiki/TablesTutorial