Jump to content

Recommended Posts

Are you submitting this to a form?

 

If so use

 

$_POST['SesssionID'];

 

If you want the Regex for this here it is

$str = '<input type="hidden" name="SessionID" value="12433690503231243369050323U[[bR??=96<692">';

preg_match_all('/value="(.*)"/i', $str, $match);

echo '<pre>';

var_dump($match);

echo '</pre>';



echo $matches[1][0];

Link to comment
https://forums.phpfreaks.com/topic/159773-parsing-html/#findComment-842687
Share on other sites

Actually I think I need the Regex. But there are more than just one <input type="hidden" ...> on the page. if I only want the SessionID, do i use:

 

$str = '<input type="hidden" name="SessionID" value="12433690503231243369050323U[[bR??=96<692">';

preg_match_all('/name="SessionID" value="(.*)"/i', $str, $match);

echo '<pre>';

var_dump($match);

echo '</pre>';



echo $matches[1][0];

Link to comment
https://forums.phpfreaks.com/topic/159773-parsing-html/#findComment-842691
Share on other sites

Sorry not sure what jacking means.

 

The original code I wanted to preg was

 

<input type="hidden" name="SwtAcctID" value="_____"><input type="hidden" name="SessionID" value="12434392951101243439295110U[[bR??=96<692"><input type="hidden" name="IsSuperUser" value="FALSE"><input type="hidden" name="IsGroupUser" value="FALSE"><input type="hidden" name="IsAdminUser" value="FALSE"><input type="hidden" name="PageAppList" value="<APPLIST><APP id="qfind" caption="Quick Find" url="qfPaymentInquiry" pageType="static"></APP></APPLIST>

 

But then it grabbed everything until the end. So a friend of mine modified the preg with a "?":

 

preg_match_all('/name="SessionID" value="(.*?)"/i', $str, $match);

 

The code works now, thank you guys! :)

Link to comment
https://forums.phpfreaks.com/topic/159773-parsing-html/#findComment-843233
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.