devWhiz Posted February 25, 2011 Share Posted February 25, 2011 $hash = file_get_contents("url"); the source code has this '<input type="hidden" name="hash" value="Mr607qtwQQuX">' how could I get preg_match or explode to parse out just the hash Mr607qtwQQuX? thanks Link to comment https://forums.phpfreaks.com/topic/228854-using-preg_match-or-explode-to-parse-out-hash/ Share on other sites More sharing options...
samshel Posted February 25, 2011 Share Posted February 25, 2011 preg_match('/name="hash" value="([a-zA-Z0-9]+)"/', $hash, $arrMatches); echo $arrMatches[1]; Link to comment https://forums.phpfreaks.com/topic/228854-using-preg_match-or-explode-to-parse-out-hash/#findComment-1179785 Share on other sites More sharing options...
devWhiz Posted February 25, 2011 Author Share Posted February 25, 2011 what would you add if the hash has a few '%' symbols in it Link to comment https://forums.phpfreaks.com/topic/228854-using-preg_match-or-explode-to-parse-out-hash/#findComment-1179792 Share on other sites More sharing options...
samshel Posted February 25, 2011 Share Posted February 25, 2011 preg_match('/name="hash" value="([a-zA-Z0-9\%]+)"/', $hash, $arrMatches); echo $arrMatches[1]; Link to comment https://forums.phpfreaks.com/topic/228854-using-preg_match-or-explode-to-parse-out-hash/#findComment-1179795 Share on other sites More sharing options...
devWhiz Posted February 25, 2011 Author Share Posted February 25, 2011 awesome thanks Link to comment https://forums.phpfreaks.com/topic/228854-using-preg_match-or-explode-to-parse-out-hash/#findComment-1179797 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.