XLT blogas

2008-11-26

Skriptas patikrinti, ar adresas egzistuoja – PHP curl

Filed under: php — dainos @ 16:33
Tags: , ,

Yra bent keletas gerų būdų patikrinti, ar adresas egzistuoja/veikia. Vienas iš jų – su CURL:

$adresas=”http://www.betkoks.lt”;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $adresas);
curl_setopt($ch, CURLOPT_USERAGENT, ‘Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_HEADER, true);
$atsakymas = curl_exec($ch);
curl_close($ch);

if(preg_match(‘/HTTP\/1\.\d+\s+(\d+)/’, $atsakymas, $yra)){
$kodas=intval($yra[1]);
if($kodas>400){
echo “Adresas neveikia”;
}
}
else {
echo “nepasiekiamas”;
}

***
$kodas>400 : čia iš esmės atsižvelgiama tik į 404 klaidą. Žinoma, galima kreipti dėmesį ir į kitas klaidas.

Pelnas iš svetainės: Adbrite

Filed under: reklama,Uždarbis — dainos @ 13:21
Tags: , , , , ,

Parašysiu šį bei tą apie Adbrite reklamos tinklą, su kuriuo turiu reikalų jau kelis metus.

Adbrite yra antras po Google Adsense pagal pelningumą ir populiarumą interneto reklamos tinklas iš tų, kurie yra prieinami lietuviams, norintiems gauti pajamų iš savo svetainės lankomumo. Nors Adsense yra neabejotinas lyderis pagal vidutinę paspaudimo kainą ir bendrą uždarbį, Adbrite yra gera alternatyva, kai kuriais atžvilgiais pranokstanti Adsense.
- Žymiai liberalesnės taisyklės dėl tinklapio turinio (iš esmės tinka beveik bet kokie tinklapiai, netgi nelegalūs, tokie kaip warez ir t.t.)
- Reklamas galima dėti į svetaines lietuvių kalba (Adsense lietuviškose svetainėse tiesiog neveikia, o jei netyčia veikia – tai neleidžiama; Adbrite reklamos veikia ir leidžiamos beveik bet kur)
- Maža bano/nesumokėjimo rizika (dirbantys su Adsense niekada negali būti 100% tikri, kad vieną dieną nebus išmesti ir negaus atlygio; Adbrite banai, galima sakyti, retenybė – Adbrite pozicija daugeliu aspektų yra liberali ir ne tokia teisuoliška ir nedraugiška tinklapių savininkams kaip Adsense)
- Yra daug reklamos formų, tinkamų įvairių tipų svetainėms (baneriai, „in-line“ nuorodos, viso puslapio reklama).

Geriausių rezultatų daug kam duoda Adsense ir Adbrite derinimas: kur įmanoma (respektabiliuose angliškuose puslapiuose) naudojama Adsense, o ten, kur Adsense draudžiama ar neveikia (pvz., lietuviškuose psl) – Adbrite. Adbrite taip pat tinka ir kaip Adsense „alternatyvios reklamos“. Tai padeda gauti kuo daugiau pajamų iš įvairių tipų svetainių.

2008-10-23

PHP cache – serverio apkrovos (CPU) mažinimas

Filed under: php — dainos @ 10:55
Tags: , , , , ,

Jei svetainė tampa labiau lankoma, o naudojama TVS nėra gerai optimizuota, ji vis labiau apkrauna serverio procesorių (CPU). Elementarus būdas dramatiškai sumažinti apkrovą – kiek įmanoma daugiau viską kešuoti (įrašyti į laikiną tekstinį failą – cache), ypač daug Mysql užklausų generuojančias TVS vietas (pvz., kiekviename puslapyje įterpiamus topus, naujausių straipsnių/nuorodų sąrašus ir pan.).
Kešavimo esmė – nustatytą laiką naudoti išsaugotą puslapio ar jo dalies kopiją. Praėjus tam laikui, kopija atnaujinama.
Kešavimui naudojamos PHP funkcijos ob_start, ob_get_contents, ob_end_flush.

Pavyzdys:
$cache_failas = “cache/failas.txt”;
$cache_laikas = 3600;
if (file_exists($cache_failas) && (time() – $cache_laikas
< filemtime($cache_failas)))
{
include($cache_failas);
}
else {
ob_start();

//php kodas, pvz paėmimas is duomenų bazes

//irasom i cache
$f = fopen($cache_failas, ‘wb’);
fwrite($f, ob_get_contents());
fclose($f);
ob_end_flush();
}

$cache_failas – failas, į kurį bus įrašoma. Jį galima sukurti iš anksto (ir atitinkamai
suchmod’inti) arba, jei nebus, jis gali būti sukurtas automatiškai (žr. apie fopen)
$cache_laikas – sekundėmis. Kas kiek laiko turi būti atnaujinama. Šiuo atveju: 3600 sek = 1 valanda

2008-07-25

Backlinkai – Pozicijų gerinimas Google paieškos rezultatuose

Filed under: reklama,Uždarbis — dainos @ 09:35
Tags: , , , , , ,

Dar šiek tiek idėjų, kaip gauti vienpusių backlink’ų (nuorodų kitose svetainėse, nukreipiančiose į jūsų svetainę), padedančių pagerinti savo svetainės pozicijas pagal įvairius raktažodžius Google paieškos rezultatuose ir taip prisidedančių prie lankomumo augimo, didesnės naudos iš svetainės ir t.t.

Pirmoji straipsnio dalis su kai kuriomis SEO idėjomis paskelbta čia. Tiesa, daug kas kartojasi, bet iš esmės pakanka nusitverti bent vieną kitą idėją ir ją įgyvendinti.

- Submit your free ebooks to ebook directories.

- Submit your downloadable software to software directories, such as Download.com

- Locate a popular site in your niche which would appreciate having you as a regular columnist. Write tips, lively commentary, product reviews, or whatever topics suit your niche.

- Syndicate your material to other sites. Create a content syndication feed (RSS feed) and include a link to your site. Use PHP rather than Javascript to ensure search engines parse your headings and links.

- Do something funny or outrageous or brilliant and people will link to your site without being asked.

- Build a useful tool

- Write an interesting article

- Run a newsworthy ‘event’ such as a contest

- Test something new that has not been done before

- Be the first in doing something on the internet

- Write something controversial

- Be the first to write the latest news in your niche

- Be the first to expose a scammer

- Disagree with an authority

- Write some funny humor

- Make an interesting picture

- Hunt for sites that complement yours and ask them to publish your articles.

- Participate helpfully in forums which allow a text link to your site in a signature. Start with the friendly, helpful AssociatePrograms.com affiliate forum. Read the forum instructions first, or you risk making an ass of yourself.

- Consider buying text link ads on other sites, for example from Linkadage or Text Link Ads. (Remember that Matt Cutts has written unfavorably about buying links.) Better still, arrange for articles to be published on other sites with a link to your site in them. You may have to use some innovative thinking to achieve this. The results make the effort worth while.

- Create simple web-based free software. Tell other sites, newsletters and forums about it and ask for a link to it.

- Create downloadable software which contains links to your site.

- Get listed in business directories.

- Make a valuable resource (lists, special reports, history of, how to, etc.)

- Write an outrageous theory and back it up with logics

- Write useful comments on something that is happening

- Give something valuable for free

- Coin a new acronym in your niche and get people to talk about it

- Become an expert in your niche and write valuable information

- Interview (e-mail/phone) prominent people and publish it.

- Be the first to research and document something

- Make a theme, plugin or piece of software

- Make a tool that others can put on their sites but that links to you

- Make a joke about a known person

- Make a resource that is just in time for a major event

- Buy ads in newsletters on your topic which are archived online.

- Locate industry-specific directories and submit your site to them. For example, if your site is on a health topic, look for health-related directories.

Tema: Rubric. Blogą talpina WordPress.com.

Follow

Gaukite kiekvieną naują įrašą į savo dėžutę.