Jump to content

Is it possible to get the value of....


andre3

Recommended Posts

i tried using pregmatch all, but it cuts out ever html tag from the page

 

saying that makes it seem as though you are doign one of two things:

 

1)using javascript

2) using curl or file_get_contents to grab the html of a page...

 

seeing as though you posted this in php, i'll guess you're using #2

 

you're gonna need to isolate that particular tag you want...assuming the content is mostly the same every time, see what is right before and after that tag, and use another preg_match and store the whole html tag in the var $tag

this is what i use: and it still not working accurate, if i put the content in a variable an pass it through preg match to get the value in between ='class1' , example: $val = "the class i want to use is <my class='class1'>"; 

 

$result = preg_match_all('%<div[^>]*[\s]class=[\'"]([^\'"]*)[\'"][^>]*>%i', $val, $matches);

$result = $matches[1][0];

 

echo "<div class='$result'>";

 

if will work like that, but if i remove this:  <my class='class1'> from the string then preg match wont return 'the class i want to use is' and if i add any other tags for example: <br/> etc to the string it wont pass them. :(

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.