Hey Guys ,
I'm trying to get some data from a website via php and need some help with some coding.
i basically used : $content = file_get_contents('siteurl'); // to get data from the site
Part 1 *************************************************************************
I now need to shift through that data to get more specific items :
Data source is something like this:
<tr>
<th>Stock No</th><td>B37659</td>
<th>Chassis No</th><td>SC11-143781</td>
</tr>
<tr>
<th>Manufacturer</th><td>Nissan</td>
<th>Model</th><td>Tiida Latio 15B</td>
</tr>
<tr>
<th>Manuf. Year</th><td>2008</td>
<th>Registration Year</th><td>2008/10</td>
</tr>
<tr>
<th>Displacement</th><td>1490CC</td>
<th>Transmission</th><td>AUTO</td>
</tr>
<tr>
<th>Fuel Type</th><td>GASOLINE</td>
<th>Current Mileage</th><td></td>
</tr>
I want to get the details for the items e.g :
$fuel_type = $x ;
$x should return "Gasoline"
the code should read this line : <th>Fuel Type</th><td>GASOLINE</td> and return the 2nd option "Gasoline"
Like match this :
<th>Fuel Type</th>
and return its corresponding value
Part 2 *************************************************************************
Get url from id or class , Its been a while since i learned php and kind of forgot how to get the url using the id & class .
Any idea how to get the $img = "url.jpg" using the id (mainimage) from the site .
<img style="width:100%;" src="url.jpg" id="mainimage"/><div class="clearfix"></div>
Part 3 *************************************************************************
Also if there are more than one image in the same class e.g :
$thumb1 = "image_url1";
$thumb2 = "image_url2";
<div id="gallery"><a href="url/stock_img2/36536/1.jpg" class="gallary-tmb"><img src="url/stock_img2/36536/1.jpg" alt="TIIDA LATIO 15B" /></a><a href="url/stock_img2/36536/2.jpg" class="gallary-tmb"><img src="url/stock_img2/36536/2.jpg" alt="TIIDA LATIO 15B" /></a></div><div class="clearfix"></div>
</div>
Any help would be greatly appreciated . Thanks Guys
I'm trying to get some data from a website via php and need some help with some coding.
i basically used : $content = file_get_contents('siteurl'); // to get data from the site
Part 1 *************************************************************************
I now need to shift through that data to get more specific items :
Data source is something like this:
<tr>
<th>Stock No</th><td>B37659</td>
<th>Chassis No</th><td>SC11-143781</td>
</tr>
<tr>
<th>Manufacturer</th><td>Nissan</td>
<th>Model</th><td>Tiida Latio 15B</td>
</tr>
<tr>
<th>Manuf. Year</th><td>2008</td>
<th>Registration Year</th><td>2008/10</td>
</tr>
<tr>
<th>Displacement</th><td>1490CC</td>
<th>Transmission</th><td>AUTO</td>
</tr>
<tr>
<th>Fuel Type</th><td>GASOLINE</td>
<th>Current Mileage</th><td></td>
</tr>
I want to get the details for the items e.g :
$fuel_type = $x ;
$x should return "Gasoline"
the code should read this line : <th>Fuel Type</th><td>GASOLINE</td> and return the 2nd option "Gasoline"
Like match this :
<th>Fuel Type</th>
and return its corresponding value
Part 2 *************************************************************************
Get url from id or class , Its been a while since i learned php and kind of forgot how to get the url using the id & class .
Any idea how to get the $img = "url.jpg" using the id (mainimage) from the site .
<img style="width:100%;" src="url.jpg" id="mainimage"/><div class="clearfix"></div>
Part 3 *************************************************************************
Also if there are more than one image in the same class e.g :
$thumb1 = "image_url1";
$thumb2 = "image_url2";
<div id="gallery"><a href="url/stock_img2/36536/1.jpg" class="gallary-tmb"><img src="url/stock_img2/36536/1.jpg" alt="TIIDA LATIO 15B" /></a><a href="url/stock_img2/36536/2.jpg" class="gallary-tmb"><img src="url/stock_img2/36536/2.jpg" alt="TIIDA LATIO 15B" /></a></div><div class="clearfix"></div>
</div>
Any help would be greatly appreciated . Thanks Guys
Last edited: