I’m trying to get the post-id my posts.
this is the format it is in–> postid-785645
the numbers are randomly generated.
<?php
$mysite = "http://example.com";
$wholepage = @file_get_contents($mysite);
// I want to use preg_match to echo just the numbers. out of the whole page.
// Basically i'm trying to have is search the whole page for -> postid-(randomly generated number) and have it echo the number from things that are in this format.
?>
You could try using the following regular expression:
Example code:
Result:
Array ( [0] => Array ( [0] => postid-785645 [1] => postid-785646 ) )I’m using
preg_match_allinstead ofpreg_matchbecausepreg_matchstops after it finds the first match.