wwfc_barmy_army Posted April 21, 2009 Share Posted April 21, 2009 Hello. I'm working on a scraping script and I just need to get this last thing; I need to get the line of text that starts with "Password:". Can i use this bit of code: // extract text from HTML echo $html->plaintext; And use some kind of if statement after? Or is there a better way? Thanks for any advice/code Quote Link to comment Share on other sites More sharing options...
.josh Posted April 21, 2009 Share Posted April 21, 2009 preg_match('~^Password:.*~',$string,$match); can't be more specific than that without more info. Quote Link to comment Share on other sites More sharing options...
wwfc_barmy_army Posted April 22, 2009 Author Share Posted April 22, 2009 Hello. I've tried: $outputtext = $html->plaintext; preg_match('~^Password:.*~',$outputtext,$match); //print_r($match); //echo $match; foreach ($match as $value) { echo $value; } But it doesn't return anything. Any ideas? Thanks. Quote Link to comment Share on other sites More sharing options...
.josh Posted April 22, 2009 Share Posted April 22, 2009 can't be more specific than that without more info. Quote Link to comment Share on other sites More sharing options...
wwfc_barmy_army Posted April 22, 2009 Author Share Posted April 22, 2009 What info do you need to know Crayon Violent ? Thanks. Quote Link to comment Share on other sites More sharing options...
.josh Posted April 22, 2009 Share Posted April 22, 2009 Oh I don't know, maybe the actual subject to which you are trying to scrape the info from might be nice. You know, the context of the situation. That sort of thing helps. Quote Link to comment Share on other sites More sharing options...
shlumph Posted April 22, 2009 Share Posted April 22, 2009 I don't want my password to be scraped :-\ Quote Link to comment Share on other sites More sharing options...
.josh Posted April 22, 2009 Share Posted April 22, 2009 Okay well then I'm sorry, I can't give you any more specific help. According to your OP you said: I'm working on a scraping script and I just need to get this last thing; I need to get the line of text that starts with "Password:". That pattern starts at the beginning of a line and looks for that exact string, matching everything to the end of that line. If print_r($match) is not showing anything then $outputtext does not contain what you think it does. That could be because your script does not properly assign the content to it, or it could be that the info you supplied about the context is bogus. As in, maybe "Password:" isn't really at the beginning of the string, or maybe that's not how it's spelled (even case-sensitive). I'd start out by echoing $outputtext to see if it has data in it in the first place. Quote Link to comment Share on other sites More sharing options...
wwfc_barmy_army Posted April 22, 2009 Author Share Posted April 22, 2009 Crayon Violent: Ok Crayon Violent, i'll check over my variables. P.s. shlumph posted that last post not me. shlumph: They are archive passwords, not account passwords or anything. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.