Jump to content

I can't reach elements between <span> here <span> ?

Recommended Posts

Hello out there! 

Firstly thanks to help people coding.

I'm trying to extract information(name and speciality)  from this link: http://www.sante-dz.com/carteinfomed.php?spe=39&nom=&rig=Alger&pubspace=i&firsturl=L21lZGVjaW5zLnBocD90aXQ9bCZtYXhSb3dzX21lZGVjaW5zPTEwMCZzcGU9MzkmcmlnPUFsZ2Vy

1-  when I try to reach the text written between <span> here <span>, I recuperate all the texts written in the same tag but only the desired information couldn't be reached,

2- I recuperate a link gathering information of every doctor,, but can't also extract just the linkw which is contained in a string


here is my simple code:

<!DOCTYPE html>
<html lang="fr">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../css/style.css" />
<div class="wrapper">
<h1>La base des medecins algeriens </h1>
require_once 'simple_html_dom.php';
                     //Create an object simple_html_dom()
                    $html = new simple_html_dom();
                    //Create an object simple_html_dom()
                    $htmll = new simple_html_dom();
                     // load the html file
                     //All links of doctors information
                    foreach($html->find( 'td[class=txtgray9all] div') as $info)
                        echo $info->onclick. '<br>'; // the string recuperated should be parsed to extract the desired 
                        //  $parsedlink= 
                       // echo  $htmll->load_file('http://www.sante-dz.com/carteinfomed.php?'.$parsedlink);
                    foreach($htmll->find('span.txtblue92ball') as $e)
                        echo $e->outertext . '<br>';// i don't get any result

Share this post

Link to post
Share on other sites

The perfect way of parsing HTML in PHP is via the library 'Querypath' its a wrapper around DOM , so no regex.
Also the syntax is very jQuery like..

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.