Jump to content

Recommended Posts

im using file_get_content to parse site

and here some html appear

Version 1.1 is out and has a huge speed increase almost 7 times faster than version 1.0.1.	I have pretty much removed the rate limit because it takes only about 17 ms on my server.	If anyone is up to it you can I think theoretically get it about 25% faster.	This is because there are only 1,296 unique expansions (from number 20 on) for reversing 16 characters and 7,776 unique expansions (from number 21 on) for reversing 20 characters.	I'm doing 36,864 and 1,179,648 expansions for reversing 16 and 20 characters respectively.	Note that you still need to do 12-ish reversing steps per attempt (32 ^ 4 and 32 ^ 5 for reversing 16 and 20 characters respectively).[code=auto:0]13c5e209f938eb123026e88a96b628f70db8c792:746573:tescrack time: 7.39 ms[/code]
can anyone help me how to print only "13c5e209f938eb123026e88a96b628f70db8c792:746573:tes" or "tes" using preg_match?
Link to comment
https://forums.phpfreaks.com/topic/277104-preg_match-help-for-beginner/
Share on other sites

Don't use regular expressions in the first place. Use DOMDocument or some other HTML parser to navigate to the place that has that data.

 

Which is hard to help with because I don't know what the HTML is.

 

Even with a DOM parser, I think you're still going to end up with the string he showed above. At that point, you need to find the text within

 

[code=auto:0]13c5e209f938eb123026e88a96b628f70db8c792:746573:tescrack time: 7.39 ms[/code]

 

Assuming those CODE tags are in the content and not a forum error, and If those "tags" are not variable (always the same), then you can use string functions to extract that text - otherwise RegEx is probably the solution.

Assuming that:

 

1. The only variability in the opening CODE tag is the number

3: The text in the CODE tags will always have two colons and you want everything up tot he first three characters after the 2nd colon

 

 

preg_match("#\[code=auto:\d\]([^\:]*:[^\:]*:.{3})#is", $input, $match);
echo $match[0];
  • 2 weeks later...
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.