Jump to content

PHP Scrape and getting a certain line


wwfc_barmy_army

Recommended Posts

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 :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.