php - need specific data from a url with file_get_contents () -


i trying read url file_get_contents(). need $invoice page.

$invoice appears on sentence following example number 789621 :

<code><div class="show invoice invoice_number_rajhi"><a href="/fatora/alrajhi/invoices/3687908533/people" class="link-blue" onclick="$.fn.colorbox({title:&quot;people visit this&quot;,oncomplete:show.onpeopleopening,oncleanup:show.onpeopleclosing,href:&‌​quot;/fatora/alrajhi/invoices/3687908533/people&quot;}); return false">789621 paid</a> show this</div></code> 

and if appears following example , how ?

  <code><li class="js-stat-show js-stat-show stat-still"> <a href="#" class="request-invoice-popup" data-activity-popup-title="invoice 789621 paid" > paid <strong>789621</strong> </a> </li></code> 

using regular expressions in php:

$myurl = "theurlyouwant";  preg_match("/return false\"\>(.*?) paid/i", file_get_contents($myurl), $matches);  $invoice = $matches[1];  echo($invoice); 

now, variable $invoice should equal invoice number


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -