Jump to content
Sign in to follow this  
Medic873

Pull Random Data

Recommended Posts

Medic873

I am trying to pull random data from 'http://www.fakenamegenerator.com/advanced.php'

but for some reason I cant can you please help me see what is wrong with my script.

#include <IE.au3>
#Include <ScreenCapture.au3>
#include <Excel.au3>
#include "array.au3"
#Include <File.au3>
#include <string.au3>
#include <INet.au3>

$RandomData = _StringBetween(_INetGetSource('http://www.fakenamegenerator.com/advanced.php'), '<h2>Your Randomly Generated Identity</h2>', '<div id="advurtise">')

$FirstName = _StringBetween ($RandomData[0], '<SPAN class=given-name>', '</SPAN> <SPAN class=additional-name>')
$MiddelIntial = _StringBetween ($RandomData[0], '</span> <span class="additional-name">', '</span> <span class="family-name">')
$LastName = _StringBetween ($RandomData[0], '</span> <span class="family-name">', '</span></span></h4> ')
$Name = $FirstName & " " & $MiddelIntial & " " & $LastName
$Street = _StringBetween ($RandomData[0], '<span class="street-address">', '</span><br /><span class="locality">')
$City = _StringBetween ($RandomData[0], '</span><br /><span class="locality">', '</span>, <span class="region">')
$State = _StringBetween ($RandomData[0], '</span>, <span class="region">', '</span> <span class="postal-code">')
$PostalCode = _StringBetween ($RandomData[0], '</span> <span class="postal-code">', '</span>                                            </div>')
$PhoneNumber = _StringBetween ($RandomData[0], '<li class="tel"><span class="value">', '</span></li>')
$EmailAddress = _StringBetween ($RandomData[0], '<li class="lab">Website:</li>', '</span> <div class="adtl">This is a real email address')
$EmailURL = _StringBetween ($RandomData[0], '</span> <div class="adtl">This is a real email address. <a href="', '" title="Fake Mail Generator">Click here to activate it!</a></div></li> ')
$Password = _StringBetween ($RandomData[0], '<li class="lab">Password:</li>', '</li>')
$MothersMaidenName = _StringBetween ($RandomData[0], "Mother's Maiden name:</li>", '</li>')
$BirthDay = _StringBetween ($RandomData[0], '<li class="bday">', ' (')
$SSN = _StringBetween ($RandomData[0], '<li class="lab">SSN:</li><li>', ' <div class="adtl">You should <a href="http://www.ssnregistry.org/">click here</a> to find out if your SSN is online.</div></li>')
$Occupation = _StringBetween ($RandomData[0], '<li class="title">', '</li> ')

Msgbox (1, "FirstName", $FirstName);

Share this post


Link to post
Share on other sites
smartee

Umm.. firstly, do you see the page source in the console when you do this?

$src=_INetGetSource("http://www.fakenamegenerator.com/advanced.php")
ConsoleWrite($src)

Edit: bad code post

Edited by smartee

Share this post


Link to post
Share on other sites
Medic873

So Im still lost can someone help

And im not sure but smartee your code didnt work for me either

Share this post


Link to post
Share on other sites
smartee

hi Medic873,

Sorry, the last line above should have been

ConsoleWrite(BinaryToString($src))
also don't forget #include <Inet.au3>. Do you see the page source now? ;)

Also, fakenamegenerator.com provides an api, why not just use that? :)

You can also order a bulk set of identities. ;)

Hope this helps,

-smartee

Share this post


Link to post
Share on other sites
Medic873

okay so this is what ive put and im still not seeing the page code.

#include <IE.au3>
#Include <ScreenCapture.au3>
#include <Excel.au3>
#include "array.au3"
#Include <File.au3>
#include <string.au3>
#include <INet.au3>
 
$src=_INetGetSource("http://www.fakenamegenerator.com/advanced.php")
ConsoleWrite(BinaryToString($src)

im getting this error "Line 10" error: Parsing function call"

Share this post


Link to post
Share on other sites
MvGulik

1) www.fakenamegenerator.com -> "This webpage is not available"

2) ConsoleWrite(BinaryToString($src) -> missing closing ')' tag.

---

BrewManNH could not find the post button. :mellow:

Edited by iEvKI3gv9Wrkd41u

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites
BrewManNH

You are missing a closing parentheses on the consolewrite command. Also, I have not been able to pull the source from that page with _Inetgetsource, although I can do it by right clicking on it and using Show Source from a browser.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
smartee

To all,

You can't grab that page's source like that because the server admin does not want you to (User-Agent check most likely). There is an API available that is offered as a paid service with 50 units free per month.

Of course you can simply set the user agent string to that of Firefox etc, but stealing the site's resources in that manner is both immoral and possibly illegal. :mellow:

That is why I last left this thread with corrected syntax vs righted logic, and a link to the API .

Share this post


Link to post
Share on other sites
MvGulik

Aha. In that case the topic can be considered more or less closed in relation to www.fakenamegenerator.com.


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

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.