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 Quote 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]; Quote 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 Quote 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]; Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.