i want to make php code what can take text from web page. theis code get text from web site, then search text waht starts with "N" and ends with "a" then script add it to array[0]. My mistake in regular expressions, please help me to fix it, sorry for my poor english
here is my code:
<?php
$url = "http://www.nokia.com/global/products/phone/lumia820/";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_exec($ch);
curl_close($ch);
preg_match_all('/^N(.*)\a$/', $result, $matches[0]);
preg_match_all('/^M(.*)\m$/', $result, $matches[0]);
preg_match_all('/^M(.*)\c$/', $result, $matches[0]);
print_r($matches[0]);
?>
If i try with html hor example, how to get the 700 mAh as array[0], BL-5CA as array[2], Nokia as array[3]
<div class="b-goods-specifications mod_cutted"> <div class="b-goods-specifications-item"> <ul class="b-goods-specifications-list"> <li class = "b-goods-specifications-row g-clearfix "> <div class="b-goods-specifications-cell"> <span> **capacity** </ span> </ div> <div class="b-goods-specifications-cell"> **700 mAh** </ div> </ li> <li class="b-goods-specifications-row g-clearfix"> <div class="b-goods-specifications-cell"> <span> **Model** </ span> </ div > <div class="b-goods-specifications-cell"> **BL-5CA** </ div> </ li> <li class="b-goods-specifications-row g-clearfix"> <div class = "b-goods-specifications-cell "> <span> **Brand** </ span> </ div> <div class="b-goods-specifications-cell"> **Nokia** </ div> </ li> <li class =" b-goods -specifications-row g-clearfix "> <div class="b-goods-specifications-cell"> <span> Type </ span> </ div> <div class="b-goods-specifications-cell"> Li -ion </ div> </ li> </ ul> </ div> </ div>