Page 2 of 2

Re: how to extract data in the url

Posted: Mon Feb 08, 2010 9:14 am
by klevis miho
for the addresses and phone numbers use again a preg_match_all:

preg_match_all('#STRING1(.+?)STRING2#s', $contents, $addresses);
$addresses = $addresses[1];

find the STRING1 and STRING2 in the source code if you know what I mean

Re: how to extract data in the url

Posted: Mon Feb 08, 2010 11:21 pm
by manojsemwal1
thanks once again..............

it fix the problem .i need the contact no and email address so we can use
preg_match_all('#<h3 class="nmwehtszdf nmwehtclrdf ">(.+?)</h3>#s', $contents, $matches);
preg_match_all('#<span class="phonetxt">(.+?)</span>#s', $contents1, $matches1);


two times or single preg_match_all() will print contact no .
so how we can use phone no inside the below foreach loop.

$matches = $matches[1];
foreach($matches as $val)
{
$values = strip_tags($val);
$myFile = "textFile.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
fwrite($fh, $values);
fclose($fh);
}

Re: how to extract data in the url

Posted: Tue Feb 09, 2010 1:06 am
by klevis miho
ok do
$matches1 = $matches1[1];

$i=0;
foreach($matches as $val)
{
$values = strip_tags($val);
$myFile = "textFile.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
fwrite($fh, $values);
fwrite($fh, $matches1[$i];
fclose($fh);
$i++;
}


im sure there is a better way to do it through

Re: how to extract data in the url

Posted: Wed Feb 10, 2010 1:48 am
by manojsemwal1
hai klevis miho

it print below line 5 times and given error and also no phone no.
Notice: Undefined offset: 0 in /home/iiewscom/public_html/culnary.php on line 44
Notice: Undefined offset: 1 in /home/iiewscom/public_html/culnary.php on line 44
Notice: Undefined offset: 2 in /home/iiewscom/public_html/culnary.php on line 44
Notice: Undefined offset: 3 in /home/iiewscom/public_html/culnary.php on line 44
Notice: Undefined offset: 4 in /home/iiewscom/public_html/culnary.php on line 44


Art Institute Online
Culinary Schools
Culinary Schools

The Art Institutes
Local results for Culinary Schools in your city
Need Local Culinary Schools ?
Culinary Education Deals
Find Culinary Schools Locally.
Looking for Culinary Schools?