mechanize

How do I automatically complete a php form using C++?

旧街凉风 提交于 2019-12-11 10:40:15
问题 What is a simple way to complete a php form, submit it and get the resulting data ? It doesn't have to be C++ but I know it best, I have the last visual studio and I need a windows executable. I found something that does this in ruby, it's called mechanize, I'm wondering if there's something similar for C++ ? 回答1: If it's a general form (i.e. you want it to work well with any HTML form, then probably your best bet is to utilize an HTML parsing library, such as http://www.codeproject.com/KB

Cannot installing mechanize for ruby on mac

◇◆丶佛笑我妖孽 提交于 2019-12-11 09:58:44
问题 I am trying to install mechanize on a Mac OS X Version 10.7.3 with ruby version 1.8.7. The problem is with one of its dependencies nokogiri. I have seen other posts about having xcode installe and I do it is version 4.3.2 . Here is the error I am receiving. Thank you in advance. sudo gem install mechanize Building native extensions. This could take a while... ERROR: Error installing mechanize: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8

Perl WWW::Mechanize — Authentication Error GETing URL

拟墨画扇 提交于 2019-12-11 09:49:01
问题 I'm trying to fill out a web form using the Mechanize library of Perl. Whenever I enter the URL into the search box it prompts the below message, and I can manually login sucessfully. However, when I run the below script, I get the following error: How do I correctly fill in the first Authentication Box credentials using my $mech object? my $mech = WWW::Mechanize->new( 'keepalive' => 1 ); my $url = "http://URL/I/NEED/TO/ACCESS"; my $username = "username"; my $password = "password"; $mech-

find links containing bold text using WWW::Mechanize

橙三吉。 提交于 2019-12-11 09:45:44
问题 Suppose content of HTML pages is <a href="abc.com"><b>ABC</b>industry</a> <a href="google.com">ABC Search</a> <a href="abc.com">Movies with<b>ABC</b></a> I want to extract only links that contain bold text. How can i do it using WWW::Mechanize? Output ABC industry Movies with ABC I used @arr=$m->links(); foreach(@arr){print $_->text;} but this finds all URLs in the page. 回答1: Without using extra modules that can parse the contents of the page, it's going to be difficult to achieve your goal

How do I scrape data through Mechanize and Nokogiri?

不羁的心 提交于 2019-12-11 09:13:53
问题 I am working on an application which gets the HTML from http://www.screener.in/. I can enter a company name like "Atul Auto Ltd" and submit it and, from the next page, scrape the following details: "CMP/BV" and "CMP". I am using this code: require 'mechanize' require 'rubygems' require 'nokogiri' Company_name='Atul Auto Ltd.' agent = Mechanize.new page = agent.get('http://www.screener.in/') form = agent.page.forms[0] print agent.page.forms[0].fields agent.page.forms[0]["q"]=Company_name

Trouble logging in with Ruby's Mechanize

女生的网名这么多〃 提交于 2019-12-11 08:39:34
问题 Trying to create an automatic login to a webpage which takes HTTP POST input but failing to do so. Here's the webpage: https://job.jobnet.dk/CV/Login/Login.aspx I created a user stacktest with password abcdefghijklmn1 if you want to try your hand at it. Here's the not-working code: require 'rubygems' require 'mechanize' agent = Mechanize.new page = agent.get 'https://job.jobnet.dk/CV/Login/Login.aspx' login_form = page.form_with(:action => 'Login.aspx') login_form['ctl00$ctl00

Python urllib2 parse html problem

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 07:39:37
问题 I am using mechanize to parse html of website, but with this website i got strange result. from mechanize import Browser br = Browser() r = br.open("http://www.heavenplaza.com") result = r.read() result is something which i can not understand. you can see here: http://paste2.org/p/1556077 Anyone can have some method to get that website HTML? with mechanize or urllib. Thanks 回答1: import urllib2, StringIO, gzip f = urllib2.urlopen("http://www.heavenplaza.com") data = StringIO.StringIO(f.read())

Mechanize + Python: how to follow a link in a simple javascript?

£可爱£侵袭症+ 提交于 2019-12-11 05:15:48
问题 short: How to execute/simulate javascript redirection with python Mechanize? location.href="http://www.site2.com/"; I've made a python script with mechanize module that looks for a link in a page and follows it. The problem is on a particular site that when I do br.follow_link("http://www.address1.com") he redirects me to this simple page: <script language="JavaScript">{ location.href="http://www.site2.com/"; self.focus(); }</script> Now, if I do: br = mechanize.Browser(factory=mechanize

How to handle line-breaks in HTML forms?

孤街醉人 提交于 2019-12-11 04:12:55
问题 I have a form with a textarea and need to submit multiple lines of input to the textarea . I use : rows = [('a','b'), ('c','d')] data_set = [ '%s\n' % '|'.join(row) for row in rows ] # Note : ADDED '\n' data_dump = ''.join(data_set) from mechanize import Browser br = Browser() br.open('http://example.com/page.html') br.select_form(nr=1) br.form['my_text_area']=data_dump br.submit() Problem: Webserver is not able to see the input as multiple lines. ADDED \n is not working for simulating line

Mechanize Python and addheader method - how do I know the newest headers?

Deadly 提交于 2019-12-11 03:33:57
问题 Currently, I'm using mechanize like this: browser = mechanize.Browser() browser.set_handle_robots(False) browser.set_handle_equiv(False) browser.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')] However, operating systems and browsers get updated and I assume that this header: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1 should be updated as well. Is