get the result

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

everydayrun
Forum Commoner
Posts: 51
Joined: Wed Jan 20, 2010 1:30 am

get the result

Post by everydayrun »

Take a look at this tool,
how it returns the result,when the user click "submit query" button?
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: get the result

Post by klevis miho »

What is your problem?
everydayrun
Forum Commoner
Posts: 51
Joined: Wed Jan 20, 2010 1:30 am

Re: get the result

Post by everydayrun »

klevis miho wrote:What is your problem?
how to make the database that returns the result.
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: get the result

Post by klevis miho »

There is no need to make a database at all
everydayrun
Forum Commoner
Posts: 51
Joined: Wed Jan 20, 2010 1:30 am

Re: get the result

Post by everydayrun »

klevis miho wrote:There is no need to make a database at all
confused! if there is no a database, where and how i can get the result?could you give me more details?thank you
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: get the result

Post by klevis miho »

Try to search on bing.com like this ip:your-website-ip.
It displays a list of websites that are on your websites IP.

Then you would use php's cURL library to get the pages that bing.com displays.
Then using some regular expressions you would get the domains that bing.com displays.
Then you would print the catched domains.
everydayrun
Forum Commoner
Posts: 51
Joined: Wed Jan 20, 2010 1:30 am

Re: get the result

Post by everydayrun »

klevis miho wrote:Try to search on bing.com like this ip:your-website-ip.
It displays a list of websites that are on your websites IP.

Then you would use php's cURL library to get the pages that bing.com displays.
Then using some regular expressions you would get the domains that bing.com displays.
Then you would print the catched domains.
but the input by the vistor is the domain name not an ip,how to change the ip into domain name?
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: get the result

Post by klevis miho »

Use this:
$ip = gethostbyname('www.example.com');
everydayrun
Forum Commoner
Posts: 51
Joined: Wed Jan 20, 2010 1:30 am

Re: get the result

Post by everydayrun »

klevis miho wrote:Use this:
$ip = gethostbyname('www.example.com');

Code: Select all

<?php
$ip = gethostbyname('$_POST['input']');
echo $ip;
?> 
now,if i get the $ip that inputed by the vistor,how to make it have some relations with bing serch.
do you know how does this site(http://www.sitesonmyip.com/) do?
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: get the result

Post by klevis miho »

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.bing.com/search?q=ip%3A'.$ip ... p=1&sc=8-0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec ($ch);
curl_close ($ch);


You could do a echo $contents; to see what you have catched.
After that you should use a regular expression to get only the domain.
everydayrun
Forum Commoner
Posts: 51
Joined: Wed Jan 20, 2010 1:30 am

Re: get the result

Post by everydayrun »

klevis miho wrote:$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.bing.com/search?q=ip%3A'.$ip ... p=1&sc=8-0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec ($ch);
curl_close ($ch);


You could do a echo $contents; to see what you have catched.
After that you should use a regular expression to get only the domain.
i am sorry,when i copied and run this code .there was nothing that i catched. what this 'http://www.bing.com/search?q=ip%3A'.$ip ... p=1&sc=8-0' mean? thank you.
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: get the result

Post by klevis miho »

Look:
http://www.bing.com/search?q=ip%3A66.14 ... p=1&sc=8-3

This address gives you the domains that are on the 66.147.240.97 ip.
everydayrun
Forum Commoner
Posts: 51
Joined: Wed Jan 20, 2010 1:30 am

Re: get the result

Post by everydayrun »

klevis miho wrote:Look:
http://www.bing.com/search?q=ip%3A66.14 ... p=1&sc=8-3

This address gives you the domains that are on the 66.147.240.97 ip.
sorry,this is inputted by the vistor,how to make it dynamicly nor fixed.
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: get the result

Post by klevis miho »

Put the variable $ip instead of a fixed ip.
everydayrun
Forum Commoner
Posts: 51
Joined: Wed Jan 20, 2010 1:30 am

Re: get the result

Post by everydayrun »

Code: Select all

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.bing.com/search?q=ip%3A'.$ip.'&form=QBLH&qs=HS&sk=&pq=&sp=1&sc=8-0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec ($ch);
curl_close ($ch);
echo $contents;
i am sorry,when i used this code,it can't catch someshing.why?
Post Reply