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

  • SEARCH
  • Home
  • 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 6250043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:20:59+00:00 2026-05-24T13:20:59+00:00

I apologize if this is a newbie question, but I cannot figure out why

  • 0

I apologize if this is a newbie question, but I cannot figure out why this doesn’t work – and I can’t seem to find anything about it when searching.

Basically, I am trying to scrape some userdetails from our site, that are not available from the sites REST api, so I have to do it manually. I have compiled a textfile with userids, that I use for fetching the wanted details from each user through Simple HTML Dom.

<?php
include('simple_html_dom.php') ;
include('functions.php') ;

$file = fopen("userids2.txt", "r") ;
while(!feof($file)) {
    $userid = fgetss($file) ;
    $url = 'http://<our URL>/user/'.$userid ;
    echo $url ; 
    webscraper($url) ;

}

fclose($file) ;
?>

and here are the contents of functions.php:

   <?php
function webscraper($loopurl) {
    $html = new simple_html_dom();
    $html->load_file($loopurl);
    $test = $html->getElementsById('ctl00_ContentPlaceHolderDefault_UserViewUC_tabContainer_tabProfile_userProfile_ddWork') ;

    foreach ($test as $element) {
        echo $element ;
    }
}
?>

The specific textfile used contains 4 userids that I know contain the information that I want. When I run the script it will only give me the output from the url from the last line in the textfile. It prints out the URLs fine, but refuses to load the remote html for the first three entries. If I delete the last line of the textfile, it then loads the new last line (which it refused to do before).

Any ideas?? Thanks in advance.

  • 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-05-24T13:21:00+00:00Added an answer on May 24, 2026 at 1:21 pm

    Doh.. I found out what the problem was. There was an “invisible” end of line character on all entries in the textfile EXCEPT the last one. So that was why it refused to work. Adding trim when retrieving the line fixed the problem:

     $userid = trim(fgetss($file)); 
    

    I probably should have known this, but at least I won’t make this mistake next time :-).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok sorry this might seem like a dumb question but I cannot figure this
I apologize for this newbie question, but I'm looking for a simple solution. I
I apologize for the newbie question, but I am struggling with this problem. I
I apologize in advance for the newbie nature of this question. Here is my
I'm a python newbie so I apologize in advance if this question has been
First : Appologize for my bad english. Sorry for this newbie software question, but
Apologies in advange for the newbie question. I can't get my head around this,
Silverlight newbie here, so I apologize if this question isn't even worded correctly. I
I'm an Android newbie so I apologize if this is a dumb question .
I apologize since this might be a common question, but I think I am

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.