How to get a website information through PHP.
Not using
file_get_contents
Is there any other way to get the website information.
example URL: http://www.quarkbase.com/google.com
In this page you will get whole information about the GOOGLE page. Like this If i enter any URL of a site i need to get the More information regarding that site.
I hope the query is very clear.
Let me know if you have any doubts regarding query
开发者_JAVA百科Thanks n advance
Fero
look at the curl functions.
php.net has a basic example.
You may want to check out the f*() functions ported from C.
They allow for finer stream manipulation.
Some good tips here.
$handle = fopen( "http://www.quarkbase.com/google.com/", "r", false, $context );
$text = '';
while ( !feof( $handle ) )
$text .= fread( $handle, 8192 );
fclose( $handle );
cURL won't solve his problem. It can perhaps help him take a screenshot of the website, but their information regarding the URL comes from a plethora of sources. Traffic info comes from Alexa, they get social networking stats from the relevant websites, and any information about the company running the website they either get from a separate database, or they have employees entering information about the larger websites they index.
There is no way to discern that type of information simply by reading the source of the page. They use tons of algorithms to search the page's contents for patterns, they use Alexa's API to get its usage data, they use the APIs of the social networking services to mine data from them, etc.
It's definitely not an easy task...
So..by website information, you mean registrar and domain information? Like through dnsstuff.com or other meta information about a company owning that domain.
Automated scraping of many of those kinds of data can be tricky. Not only do you need to get that info from a few places, but many of those places will block you if they find you not obeying their robots.txt.
You need to make a more precise list of the things you want to collect. Google for "dns tools" and you'll find things like http://dnsstuff.com that will lead you closer to getting this information. Sometimes you have to go to registrars like networksolutins.com to get the info as well. Also, look into the unix whois command, and the unix dig command.
精彩评论