ok so there is an example of url.
https://www.finn.no/car/used/search.html?orgId=3553552&sort=PUBLISHED_DESC
In here I have adverticemets stored in tags. I need to collect them each time page on my site is geting loaded and display them to the visitor also changing some style options like background and how they apear in general on my website.
Also there is pagination option so would need to transfet that too.
Only option this market place deliver is iFrame that looks very bad in 2023 world.
Adress of original site where this will be posted: https://bbvest.no
I tried code with no succses:
<?php
$url="https://www.finn.no/car/used/search.html?orgId=3553552&sort=PUBLISHED_DESC";
$html=file_get_contents($url);
$doc = new DOMDocument();
$doc->loadHTML($html);
$div=$doc->getElementsByClassName("ads__unit");
?>
<div><?php echo $div; ?></div>
thanks for any help.
2
Answers
I used this sintax It's takes less time to load and also it's grabs all the contents and places it nicely. with import of css I was able to get all I wanted. Now I can go ahead and make additable css styles and also other setups.
Plan is to get this to working WP/JOMLA plugin.
Class DOMDocument does not contains method getElementsByClassName
to get the text and image,
try use regex preg_match_all,
or