Jump to content

PHP buffer split, please help im stupid


luke777

Recommended Posts

Hi there,

 

Can anyone show me how I can grab the value "c87cc576092fe1a0f5ac3d50091694b4" out of this string, it changes.

 

Also its coming from a socket a $buffer variable, so How can I do this without grabbing everything else aswell, ie all the data after it too

 

$buffer = fgets($fp, 4096);

 

/*** recieve data looks like this - <dd><input type="hidden" name="sid" value="c87cc576092fe1a0f5ac3d50091694b4" />

 

    fclose($fp);

}

 

fclose($Handle);

 

If someone could show me how to do this, I think you can do it with the split function, i just dont know how. if someone could show. i'd be SO greatful

Link to comment
Share on other sites

You could use preg_match to capture the number that you are looking for. If you have not used a regular expression before then tell us because it might seem like magical voodoo otherwise.

 

if (preg_match('/[0-9a-f]{32}/', $buffer, $match)) {
    $value = $match[0];
    echo "Found sid value $value";
} else {
    echo "Could not find sid value ";
}

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.