PHP REGEXP PLEASE (I CANT BELIEVE I CANT FIGURE THIS OUT FROM ALL THE EXAMPLES)

odes.php%3Fusr_click_id%3D2151%26usr_schedule_id%3D24x7%26ste

I need the # 2151 from a page full of html but the above is a 'snippet' from it
BetteringAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
hernst42Connect With a Mentor Commented:
preg_match('/odes\.php%3Fusr_click_id%3D(\d+)%26/', $html, $m);#
echo $m[1];
0
 
RoonaanCommented:
Hello Bettering,

Try:

<?php

$url = 'odes.php%3Fusr_click_id%3D2151%26usr_schedule_id%3D24x7%26ste';

$_url = urldecode($url);
$_parts = parse_url($_url);
$_query = $_parts['query'];
parse_str($_query, $_array);

echo 'Click id: '.$_array['usr_click_id'];
?>


Regards,

Roonaan
0
 
BetteringAuthor Commented:
THANK YOU
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.