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 573651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:44:47+00:00 2026-05-13T13:44:47+00:00

My friend has a forum, which is full of posts containing information. Sometimes she

  • 0

My friend has a forum, which is full of posts containing information. Sometimes she wants to review the posts in her forum, and come to conclusions. At the moment she reviews posts by clicking through her forum, and generates a not necessarily accurate picture of the data (in her brain) from which she makes conclusions. My thought today was that I could probably bang out a quick Ruby script that would parse the necessary HTML to give her a real idea of what the data is saying.

I am using Ruby’s net/http library for the first time today, and I have encountered a problem. While my browser has no trouble viewing my friend’s forum, it seems that the method Net::HTTP.new(“forumname.net”) produces the following error:

No connection could be made because the target machine actively refused it. – connect(2)

Googling that error, I have learned that it has to do with MySQL (or something like that) not wanting nosy guys like me remotely poking around in there: for security reasons. This makes sense to me, but it makes me wonder: how is it that my browser gets to poke around on my friend’s forum, but my little Ruby script gets no poking rights. Is there some way for my script to tell the server that it is not a threat? That I only want reading rights and not writing rights?

Thanks guys,

z.

  • 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-13T13:44:47+00:00Added an answer on May 13, 2026 at 1:44 pm

    Scraping a web site? Use mechanize:

    #!/usr/bin/ruby1.8
    
    require 'rubygems'
    require 'mechanize'
    
    agent = WWW::Mechanize.new
    page = agent.get("http://xkcd.com")
    page = page.link_with(:text=>'Forums').click
    page = page.link_with(:text=>'Mathematics').click
    page = page.link_with(:text=>'Math Books').click
    #puts page.parser.to_html    # If you want to see the html you just got
    posts = page.parser.xpath("//div[@class='postbody']")
    for post in posts
      title = post.at_xpath('h3//text()').to_s
      author = post.at_xpath("p[@class='author']//a//text()").to_s
      body = post.xpath("div[@class='content']//text()").collect do |div|
        div.to_s
      end.join("\n")
      puts '-' * 40
      puts "title: #{title}"
      puts "author: #{author}"
      puts "body:", body
    end
    

    The first part of the output:

    ----------------------------------------
    title: Math Books
    author: Cleverbeans
    body:
    This is now the official thread for questions about math books at any level, fr\
    om high school through advanced college courses.
    I'm looking for a good vector calculus text to brush up on what I've forgotten.\
     We used Stewart's Multivariable Calculus as a baseline but I was unable to pur\
    chase the text for financial reasons at the time. I figured some things may hav\
    e changed in the last 12 years, so if anyone can suggest some good texts on thi\
    s subject I'd appreciate it.
    ----------------------------------------
    title: Re: Multivariable Calculus Text?
    author: ThomasS
    body:
    The textbooks go up in price and new pretty pictures appear. However, Calculus \
    really hasn't changed all that much.
    If you don't mind a certain lack of pretty pictures, you might try something li\
    ke Widder's Advanced Calculus from Dover. it is much easier to carry around tha\
    n Stewart. It is also written in a style that a mathematician might consider no\
    rmal. If you think that you might want to move on to real math at some point, i\
    t might serve as an introduction to the associated style of writing.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A friend has developed a corporate website which has a mailto link as the
hello friends i am having two frames, each frame has a html form which
My friend has a website built on wordpress and the developer has left the
A friend has asked me to look into developing a custom system for his
A friend has created a few tables for me and used nvarchar(max) on around
One of my friend has been asked with a question Retrieving the max top
background: My friend has a minecraft server with a white list. The community for
A friend of mine has inherited an old Joomla 1.0.x site, that amongst other
A friend of mine has to send a normal email using ONLY HTML/HTML5 (or
My friend says that Django only has 1 thread or something? And I have

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.