patentu Posted May 23, 2011 Share Posted May 23, 2011 What modification should i bring to this script to make a mass parsing not only for one url,for 200 at once or more.Hope you understand,thank you <?php $the_url = isset($_REQUEST['url']) ? htmlspecialchars($_REQUEST['url']) : ''; ?> <form method="post"> Please enter full URL of the page to parse (including http://):<br /> <input type="text" name="url" size="65" value="<?php echo $the_url; ?>"/><br /> <input type="submit" value="Parse Emails" /> </form> <?php if (isset($_REQUEST['url']) && !empty($_REQUEST['url'])) { // fetch data from specified url $text = file_get_contents($_REQUEST['url']); } elseif (isset($_REQUEST['text']) && !empty($_REQUEST['text'])) { // get text from text area $text = $_REQUEST['text']; } // parse emails if (!empty($text)) { $res = preg_match_all( "/[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}/i", $text, $matches ); if ($res) { foreach(array_unique($matches[0]) as $email) { echo $email . "<br />"; } } else { echo "No emails found."; } } ?> Link to comment https://forums.phpfreaks.com/topic/237171-for-each-url/ Share on other sites More sharing options...
patentu Posted May 24, 2011 Author Share Posted May 24, 2011 nobody? Link to comment https://forums.phpfreaks.com/topic/237171-for-each-url/#findComment-1219339 Share on other sites More sharing options...
requinix Posted May 24, 2011 Share Posted May 24, 2011 If you name the input "url[]" then $_POST["url"] will be an array that you can foreach over. foreach ((array)$_POST["url"] as $url) { // do your email scraping stuff } With the generosity out of the way I can ask: What's this script for? Link to comment https://forums.phpfreaks.com/topic/237171-for-each-url/#findComment-1219356 Share on other sites More sharing options...
patentu Posted May 24, 2011 Author Share Posted May 24, 2011 parse email address from links but i don't know php where should i insert that line?and how can i make a bigger input where each line will be an url,because like this i still have only one url Link to comment https://forums.phpfreaks.com/topic/237171-for-each-url/#findComment-1219375 Share on other sites More sharing options...
requinix Posted May 24, 2011 Share Posted May 24, 2011 parse email address from links Well yeah, but what for? but i don't know php where should i insert that line? It basically goes around all the code that extracts the emails. Give it a shot. and how can i make a bigger input where each line will be an url,because like this i still have only one url The HTML is ... Plug in appropriate numbers for rows= and cols=. Link to comment https://forums.phpfreaks.com/topic/237171-for-each-url/#findComment-1219379 Share on other sites More sharing options...
patentu Posted May 24, 2011 Author Share Posted May 24, 2011 yeah i thought to textarea but doesn't work,it takes only the first link from the textarea. <textarea name="url" rows="20" cols="67"></textarea> Link to comment https://forums.phpfreaks.com/topic/237171-for-each-url/#findComment-1219386 Share on other sites More sharing options...
patentu Posted May 24, 2011 Author Share Posted May 24, 2011 http://domeniumeuma.com/a.php Link to comment https://forums.phpfreaks.com/topic/237171-for-each-url/#findComment-1219392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.