Jump to content

Recommended Posts

Why are you double escaping the forward slash? And are you sure that exactly

 

<input type="hidden" value="..." name="Checkit"/>

 

appears in the haystack?

 

Your sample data says MemberId, so is Checkit right? Also be sure the cases match, or add the pattern modifier i after the last slash in the pattern to make the search case-insensitive.

Hi. Tbh, I'm guessing here. I'm just trying to use code from other examples.

 

Here's what I have:

 

$pattern = '/<[^>]*name="Checkit"[^>]*value="([^"]+)/';
preg_match($pattern,$this->result,$matches);
array_shift($matches);
print_r($matches);

 

It just printed "Array()".

 

Here's what I found in the source ($this->result)

 

<input type=hidden name=Checkit value=35806834>

Ok. I'm getting somewhere:

 

$pattern = '/<[^>]*name=Checkit[^>]*value=([^"]+)/';
preg_match($pattern,$this->result(),$matches);
array_shift($matches);
print_r($matches);

 

It matched ok, but it also took in the code after it. So I got value=8934782348> <img src

 

Etc

Great, was about to suggest that change :)

 

But beware that your pattern also would match something weird like

 

<div weirdname=Checkitvalue=12345

 

If the syntax in your source doesn't change, I would probably go with something simple like

 

~<input type=hidden name=Checkit value=([0-9]+)>~

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.