1
I’m picking up information from movie posters from a movie site, using Simple Html Dom.
<?php
include("simple_html_dom.php");
$html = file_get_html("http://arcoplex.com.br/?lang=059");
To get the titles of the movies I make:
foreach($html->find('.Cartaz .filme-single-name text') as $titulo) {
echo $titulo . '<br>';
}
To get the src of the movie cover images I make:
foreach($html->find('.Cartaz .filme-img') as $capa) {
echo $capa->src . '<br>';
}
To get the link of the movies I make:
foreach($html->find('.Cartaz .mais_info a') as $link) {
echo $link->href . '<br>';
}
The result is like this:
Knowing all this, how do I join the information of each movie together in an array/json?
Example:
{
filmes: {
1: {
titulo: 'A FREIRA',
capa: 'http://arcoiriscinemas.com.br/2014/wp-content/uploads/2018/08/mini2-1-175x285.jpg',
link: 'http://arcoplex.com.br/filme/a-freira-2/?lang=059'
},
2: ...............,
3: ...............,
etc,
}
}
Possible duplicate of Access data within PHP array
– fernandosavio