Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7783647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:54:01+00:00 2026-06-01T19:54:01+00:00

What I currently do is, Parse texts from a URL, and then clean the

  • 0

What I currently do is, Parse texts from a URL, and then clean the texts and explode them by spaces and save to a file.

What I find hard is,

Saving only unique files incase of scraping multiple urls:

case : scraped words from site.com/page1 and saved unique words to file. When scraping site.com/page2, I need to check if each word is in the file already and save it only if its not present.

What I have in my mind is, take $word[0], and fgets each line from the file and check and save if its not found. But that would be like thousands – hundred thousand times of iterations.

I am not looking for any codes, but just an idea how to handle it efficiently and fast.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:54:03+00:00Added an answer on June 1, 2026 at 7:54 pm

    I’m assuming that you have already stored unique words you got from site1 in a file called site1.txt, and you’ve already scraped words from site2 in an array called $site2, now you’d like to store $site2 line by line in a file site2.txt, only storing unique words:

    $wordsInFile1 = file('site1.txt');
    $wordsInFile1 = array_flip($wordsInFile1);
    
    foreach($site2 as $i => $word) {
        if(isset($wordsInFile1[$word])) {
           unset($site2[$i]);
        }
    }
    
    // now $site2 contains unique words from site2 and words that are not in site1.txt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently my application takes in a text file/files, parses them into another file type
Currently I just have a file like this that I manually parse into a
I'm currently writing a simple .sh script to parse an Exim log file for
I'm trying to parse some returned html (from http://www.google.com/movies?near=37130 )to look for currently playing
I'm currently wanting to find out an XMLNode from a text location. I have
I'm currently trying to return msgpack http://msgpack.org/ from a ruby sinatra service and parse
I'm currently trying to parse a document into tokens with the help of regex.
Currently I am working with the project in which I need to parse complex
I am currently using Jsoup to parse a html. The code is quite simple:
Our continuous integration system currently runs a perl script to parse our sln/proj files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.