Jump to content

preg_match to parse a post ID


wuwei101

Recommended Posts

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.html

I'm trying to get the nnn out of the posts.

Thanks
Link to comment
https://forums.phpfreaks.com/topic/13690-preg_match-to-parse-a-post-id/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.