File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/API/Finance/CompanyResults/PostFinder.php
Back
<?php $con=mysqli_connect("localhost:3306", "marketdatauser_ci", "d7o7A8%s2d7", "market_data_ci"); include_once("simple_html_dom.php"); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://www.equitybulls.com/index.php', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 400, CURLOPT_CONNECTTIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET' )); $response = curl_exec($curl); $html = str_get_html($response); $ul = $html->find('ul[class="spost_nav"]',0); $sql = "SELECT `link` AS 'LINK' FROM `eb_post_list`"; $rows = $con->query($sql); $oldTitles = array(); foreach($rows as $tl) { array_push($oldTitles,$tl['LINK']); } foreach($ul->find('li') as $li) { $a = explode('=',$li->find('a',0)->href); $href = $a[1]; $name = $string = str_replace("'", '',$li->find('a',1)->plaintext); $img_link = 'https://www.equitybulls.com/' . $li->find('img',0)->src; if($img_link == "https://www.equitybulls.com/equitybullsadmin/uploads/thumbnails/tn_eb_news.jpg") $img_link = 'https://play-lh.googleusercontent.com/ML6vN3SpJZmNCpMyAJpL9NGpA2c9yi9HvPIOduLZVorLwoG_5A6hT4Zy3y9vMOXKb8U'; if(!in_array($href,$oldTitles)) { $str = "https://www.equitybulls.com/category.php?id=$href"; echo $name . '<br>'; curl_setopt_array($curl, array( CURLOPT_URL => $str, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', )); $response = curl_exec($curl); $html2 = str_get_html($response); $div = $html2->find('div[class=single_page_content]',0); $no = 0; while($no < count($div->find('a'))) { $div->find('a',$no)->outertext = ''; $no = $no + 1; } $no = 0; while($no < count($div->find('h3'))) { $div->find('h3',$no)->outertext = ''; $no = $no + 1; } $no = 0; while($no < count($div->find('h4'))) { $div->find('h4',$no)->outertext = ''; $no = $no + 1; } $div->find('h3',0)->outertext = ''; $div->find('img',0)->outertext = ''; $myfile = fopen("/var/www/vhosts/cipherteam.in/httpdocs/API/Finance/CompanyResults/dist/html/$href.html", "w"); fwrite($myfile, $div); fclose($myfile); date_default_timezone_set("Asia/Kolkata"); $pdate = date("h:i A d-m-Y"); $sql = "INSERT INTO `eb_post_list` (`id`, `title`, `link`, `img_link`,`post_date`) VALUES (NULL, '$name', '$href', '$img_link','$pdate');"; $con->query($sql); } } curl_close($curl); ?>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings