luke777 Posted November 3, 2010 Share Posted November 3, 2010 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 More sharing options...
salathe Posted November 3, 2010 Share Posted November 3, 2010 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 https://forums.phpfreaks.com/topic/217645-php-buffer-split-please-help-im-stupid/#findComment-1129877 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.