bluesurfingjaguar Posted December 14, 2009 Share Posted December 14, 2009 Hi, does php have any functionality that enables a programmer to extract information from a website on the internet and display it on their own? Any help or suggestions on where to go and look for a solution will be much appreciated. Link to comment https://forums.phpfreaks.com/topic/185073-multiple-websites-question/ Share on other sites More sharing options...
Buddski Posted December 14, 2009 Share Posted December 14, 2009 Have a read of this.. It might help you out, it might not http://www.merchantos.com/makebeta/php/scraping-links-with-php/ Link to comment https://forums.phpfreaks.com/topic/185073-multiple-websites-question/#findComment-976913 Share on other sites More sharing options...
Deoctor Posted December 14, 2009 Share Posted December 14, 2009 hai i wrote this one long back just check it out $ch = curl_init();curl_setopt($ch, CURLOPT_URL, "http://chaitu09986025424.blog.co.in");curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);$output = curl_exec($ch);echo $output; if u like to get the code with the html tags then use the echo like this. echo htmlspecialchars($output); if u want the exact source code of the website then u can get it more easily. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><table align="center" border="1" bordercolor="black" > <tr><td align="center" bgcolor="Green">Enter Website :<input name="Website" type="text" size="100" value="http://" ></td></tr> <tr><td align="center"><input type="submit" name="submitBtn" value="Submit"></td></tr></table> </form><?phperror_reporting (off);// Get the HTML source of google$site_address=$_POST['Website'];//$count = file ('http://rediff.com/'); $count = file ($site_address);// Loop through our arrayif($site_address==''|| $count==''){ echo "Please enter a valid URL";}else{foreach ($count as $line_num => $line) {$line_new=htmlspecialchars($line);echo "<table align='center' width='95%' border='0' cellpadding='5' cellspacing='5'><tr style='background:red;font-color:white;font-weight:strong;'> <td colspan='2'>Line #{$line_num} :</td><td bgcolor=yellow width=100%><font face=Verdana, Arial, Helvetica, sans-serif size=2><b>$line_new</b></font></td></tr></table><br>\n";}}?> if u want to check the last one the working example is at http://drvirusindia.co.cc/code.php Link to comment https://forums.phpfreaks.com/topic/185073-multiple-websites-question/#findComment-976915 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.