wuwei101 Posted July 5, 2006 Share Posted July 5, 2006 hello,Here's the code I have:[code]if (! PEAR::isError($req->sendRequest())) { if (preg_match('/edg176\/(\d+)/', $req->getResponseBody(), $matches)) { $xangaPostID = $matches[1];[/code]I am trying to parse the post ID number from my xanga page. I am not sure why the (\d+) isn't working , since the post ID is simply everything after the edg176/.The whole url usually looks like this: http://www.xanga.com/edg176/nnn/xxx.htmlI'm trying to get the nnn out of the posts. Thanks Quote Link to comment Share on other sites More sharing options...
toplay Posted July 5, 2006 Share Posted July 5, 2006 That should work, but you want to use preg_match_all() to get all the values and then reference them like $matches[1][0], $matches[1][1], $matches[1][2], etc. Quote Link to comment Share on other sites More sharing options...
wuwei101 Posted July 7, 2006 Author Share Posted July 7, 2006 Thanks. I've read the documentation in the php manual for preg_match_all and I'm confused about what the set of 2 flags means. Quote Link to comment 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.