Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get($param) {
- $big_array = array();
- foreach ($param as $k => $v) {
- preg_match_all($v, $GLOBALS['post'], $out);
- $out = (isset($out[1][0]) && $out[1][0] != null) ? $out[1][0] : null;
- $array = array(
- $k => $out,
- "pagina" => $GLOBALS['pagina']
- );
- $big_array = array_merge($big_array, $array);
- }
- echo json_encode($big_array);
- }
- $i = 1;
- foreach ($receitas[1] as $rc) {
- if ($i == 6){break;}else{$i++;}
- $url_post = "https://www.receitassupreme.net" . $rc;
- if (!@file_get_contents($url_post)) {
- echo "<hr> sem retorno <hr>";
- continue;
- }
- $GLOBALS['post'] = file_get_contents($url_post);
- $regex = array(
- "imagem"=>"/(https\:\/\/i0.wp.com\/www.receitassupreme.net\/.*?)\?/",
- "titulo"=>"/<h1>(.*?)<\/h1>/s",
- "categoria"=>"/<a href='\/category\/.*?'>(.*?)<\/a>/",
- "ingredientes"=>"/<ul class='ing'>(.*?)<\/ul>/s",
- "preparo"=>"/<div class='mpc'>(.*?)<\/div>(.*?)<\/div>/s"
- );
- get($regex);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement