Solved

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

Posted on 2008-06-22
3
241 Views
Last Modified: 2008-07-03
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
0
Comment
Question by:Bettering
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 21843749
preg_match('/odes\.php%3Fusr_click_id%3D(\d+)%26/', $html, $m);#
echo $m[1];
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 21843755
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
 

Author Comment

by:Bettering
ID: 21843762
THANK YOU
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question