PHP file() to foreach array and into img -


i have been trying convert images results list produced file() file_get_contents , have got far cant seem getting where: here's got:

<?php $data = file('http://cadenanoticias.com.mx/galerias/notas/22925/');  foreach((array)$data $whoisline){ echo '<img src="http://cadenanoticias.com.mx/galerias/notas/22925/'.$whoisline.'">'; } ?> 

so far can see ending double quotes , closing bracket , that's it.

any idea on how achieve this?

with little of php simple html dom parser following.

<?php require "simple_html_dom.php";  // create dom url or file $html = file_get_html("http://cadenanoticias.com.mx/galerias/notas/22925/");  // find images foreach($html->find("a") $element) {     if (substr(strrchr($element->href,'.'),1) == "jpg") {         echo '<img src="http://cadenanoticias.com.mx/galerias/notas/22925/'. $element->href .'">';     } } 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -