Идеята от сайт с joomla да експортирам данните в друг сайт. От админ панела спрях friendly url-тата и видях, че тия продукти са с item_id=212 , продуктите от базата(и самия сайт, че има броячт които се вижда) видях, че са около 350 и затова слагам нацелване до 10 000 🙂 след като видя, че има голяма поредица неуспешни го спирам 🙂 и така събирам всичките на 100% 🙂
root@gama:# cat joomla_get_products.php
<?php
$myFile = „products_url.txt“;
$fh = fopen($myFile, ‘a’) or die(„can’t open file“);$ch1=curl_init();
for ($i=1;$i<=10000;$i++)
{
$url=“http://www.site.bg/index.php?option=com_mtree&task=viewlink&link_id=$i&Itemid=212″;
curl_setopt($ch1,CURLOPT_URL,“$url“);
curl_setopt($ch1,CURLOPT_CONNECTTIMEOUT,20);
curl_setopt($ch1,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch1, CURLOPT_TIMEOUT, 30);
curl_setopt($ch1, CURLOPT_REFERER,““);
curl_setopt($ch1, CURLOPT_USERAGENT,“Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)“);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, 1);
$buf = curl_exec($ch1);$buf=preg_replace(‘#\r?\n#’, ‘ ‘, $buf);$buf = preg_replace(‘/\s\s+/’, ‘ ‘, $buf);
preg_match_all(„/<title>(.*?)<\/title>/“,$buf,$matches);
$error=$matches[1][0];if ($error==“404 – Страницата не е намерена“)
{
echo „Error: $i\n“;
}
else
{
echo „$url\n“;
fwrite($fh, „$url\n“);
};
};//End of for ($i=1;$i<=10000;$i++)?>
Logged in as {{omniform_current_user_display_name}}. Edit your profile. Log out? Required fields are marked *
Your email address will not be published. Required fields are marked *
Comments are closed.
You must be logged in to post a comment.