Jump to content

Read Array From Text File Screen Scrape


twittoris

Recommended Posts

I have created a small scraper which saves content to html and links from the scrape in an array within a text file. I want to have the script run for each link that is in the text document.

 

the text document looks like this:

 

Array

(

    [0] =>  id="cnn_switchEdition_intl" href="http://edition.cnn.com/?cnn_shwEDDH=1" title="CNN INTERNATIONAL"

    [1] =>  href="javascript:void(0)" onclick="showOverlay('profile_signup_overlay');return false;" title=""

    [2] =>  href="javascript:void(0)" onclick="showOverlay('profile_signin_overlay');return false;" title=""

    [3] =>  id="nav-home" class="nav-media no-border nav-on" href="/" title="Breaking News, U.S., World Weather Entertainment and Video News from CNN.com"

    [4] =>  id="nav-video" class="nav-media no-border" href="/video/" title="Video Breaking News Videos from CNN.com"

    [5] =>  id="nav-newspulse" class="nav-media" href="http://newspulse.cnn.com/" title="NewsPulse from CNN.com"

    [6] =>  id="nav-us" href="/US/" title="U.S. News Headlines Stories and Video from CNN.com"

    [7] =>  id="nav-world" href="/WORLD/" title="World News International Headlines Stories and Video from CNN.com"

Link to comment
https://forums.phpfreaks.com/topic/196012-read-array-from-text-file-screen-scrape/
Share on other sites

If you're planning on doing a load of link scraping, I'd suggest a database rather than a file. However, you still have to remove all those excess coding (such as the href="javascript...") and just save the URLs themselves. After that, a loop would be helpful to go back in and crawl the rest of those pages.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.