| Server IP : 104.21.21.239 / Your IP : 216.73.216.11 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/mitzvahm/public_html/_scripts/html_parser/ |
Upload File : |
<?php
// example of how to use basic selector to retrieve HTML contents
include('simple_html_dom.php');
include('../../wp-config.php');
//echo DB_HOST;
//echo DB_USER;
//echo DB_NAME;
//phpinfo();
$con = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
mysql_select_db(DB_NAME, $con);
$sql = "SELECT * FROM wp_posts WHERE post_type = 'post' AND post_content LIKE '%/vendor-directory/%'";
$result = mysql_query($sql) or die(mysql_error());
$counter = 0;
while($row = mysql_fetch_array($result)) :
$counter = $counter + 1;
echo '<BR />'.$row['ID'].' === '.$row['post_title'].' === '.$row['post_type'].'<BR />';
$html = str_get_html($row['post_content']);
foreach($html->find('a') as $e) :
if (strpos($e->href,'/vendor-directory/') > 0) :
echo $e->href.'<BR />';
//echo 'Width='.$e->width.'<BR />';
//echo 'Height='.$e->height.'<BR />';
//$e->width = '80';
//$e->height = '78';
endif;
endforeach;
$str_content = $html;
//$sql_upd = "UPDATE wp_posts SET post_content = '".mysql_real_escape_string($str_content)."' WHERE ID = ".$row['ID'];
//$result_upd = mysql_query($sql_upd) or die(mysql_error());
//echo $sql_upd.'<BR />';
$html->clear();
unset($html);
endwhile;
echo '<br /><br />Post Counter: '.$counter;
?>