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
https://forums.phpfreaks.com/topic/217645-php-buffer-split-please-help-im-stupid/
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 ";
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.