0

Hi, can anyone guide me in the right direction with the following:
I want to start a hosting reseller service, didnt find a relative category to post in but my question is related to php so...

I want to develop a site where users can query available domain names, the thing is there is no ready made API for the particular domain that my users need to query. it is for .CO.ZA the main site that handles all of the registrations is http://co.za/whois.shtml

Im suppose i have to develop something from scratch, please point me in the right direction

3
Contributors
8
Replies
9
Views
6 Years
Discussion Span
Last Post by designalex
0

Hi the way is to set a script who will post the domain name at this register server and will get the info from the same site which you have provide us.

http://co.za/cgi-bin/whois.sh?Domain=DOMAIN_NAME&Enter=Enter

check DOMAIN_NAME there is the name of the required domain without ending .co.za

you should make script which will get infor from this url (where DOMAIN_NAME is the required name) and will get the page code (with searching for the string where its written is the domain free or not , depending of the answer it will get results to your users..)

0

thanks man, that helps alot, i tried that url on their site and i see what you mean by DOMAIN_NAME, its a string containing the requested domain name.

where im stuck for a start is to right i script to check from my site using
(http://co.za/cgi-bin/whois.sh?Domain=DOMAIN_NAME&Enter=Enter)

and how to read the result to determine if its available or not and also to get that result back to my site so that i can proceed accordingly, sorry for being such a dummmy!

0

yOU CAN USE An iframe for the url or use curl to scrape the content. However, would co.za object to you accessing the data via their page?

Edited by diafol: n/a

0

I don't think so hey, many many websites somehow query available .co.za domains and i dont think theres any other way of doing it. ive been looking around for different options but obviously the current big hosts are'nt going to tell me how they do it.

Im going to look through some CURL tutorials. I will post back here again

0

yep, curl would be better as iframes do not resize dynamically. Also, scraping content allows you greater control over the css (IMO).

0

then again, i just want to read from the page, if it says the domain name is available i want to formulate my own message and vica versa. i dont actually want to input the exact content from the other site. i think that they would definitely have a problem if i actually inserted a portion of their page to my site.

Is CURL still the way forward for me?

its just a pity they dont have some sort of a flag that can be used, i need to read the page and see the difference in the results between an available and un-available domain name, nothing really stands out and i hope the results are uniform. ill post back shortly, let me just get my head through the clouds. thanks ardav

0

You can search for "no match" as a term with preg_match:

<pre> 
Search on tomjones (.co.za)
Match: No Matches
    This domain is available for registration. The first correct application
    received and processed for this domain should be successful.
</pre>

THat's the html returned by a search for tomjones.co.za

You could do something like this if you build your own form with a textbox called formstring:

$formstring = $_POST['formstring'];
$str = file_get_contents("http://co.za/cgi-bin/whois.sh?Domain=$formstring");
if(preg_match("/Match: No Matches/",$str)){
	echo "The domain $formstring.co.za is available";
}else{
	echo "The domain $formstring.co.za seems to be registered to...";
	//strip further info from $str with preg_match
}

This will work if your host allows the getting of remote files - some don't.
Although the above worked for me, I'd be really careful about it - have a look here for T&C's or contact them for permission to use this type of script:

http://co.za/terms-conditions.shtml

You would be using their resources after all.

0

I just id post back to let all know ive emailed .co.za to ask them permission to use the above techniques. still waiting for them to get back to me

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.