Created
November 15, 2017 19:17
-
-
Save rotten77/b4d68636fc45f774727ebe1ea8caae17 to your computer and use it in GitHub Desktop.
Automatická obnova inzerátů na Hudebnibazar.cz a MIDI.cz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Automatické prodloužení inzerátů na Hudebníbazar.cz | |
*/ | |
define('EMAIL', ''); | |
define('PASS', ''); | |
// Základní nastavení | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_COOKIEJAR, dirname(__FILE__) .'/cookie-hb.txt'); | |
curl_setopt($curl, CURLOPT_URL, "https://hudebnibazar.cz/prihlasit/"); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); | |
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE); | |
curl_setopt($curl, CURLOPT_AUTOREFERER, TRUE); | |
curl_setopt($curl, CURLOPT_TIMEOUT, 10); | |
$contents = curl_exec($curl); | |
// Zjištění FORM_ID | |
$formUid = ""; | |
if(preg_match_all("/name=\"form_uid\" value=\"([0-9a-z]+)\"/", $contents, $matches)) { | |
$formUid = $matches[1][0]; | |
} else { | |
die('Nebylo nalezeno FORM ID'); | |
} | |
// Přihlášení | |
curl_setopt($curl, CURLOPT_URL, "https://hudebnibazar.cz/uzivatel/prihlasit4m/"); | |
curl_setopt($curl, CURLOPT_POST, 1); | |
curl_setopt($curl, CURLOPT_POSTFIELDS, array("form_uid" => $formUid, "form_akce" => "prihlasit","submitbtn" => "1", "Email" => EMAIL, "HesloNeHash" => PASS)); | |
curl_exec($curl); | |
// Načtení stránky "Moje inzeráty" | |
curl_setopt($curl, CURLOPT_URL, "https://hudebnibazar.cz/uzivatel/meinzeraty/"); | |
$contents = curl_exec($curl); | |
// Zjištění odkazů a prodloužení | |
if(preg_match_all("/posunNahoru\/\?ID=([0-9]+)\"/", $contents, $matches)) { | |
foreach($matches[1] as $idInzeratu) { | |
curl_setopt($curl, CURLOPT_URL, "https://hudebnibazar.cz/inzerat/posunNahoru/?ID=".$idInzeratu); | |
curl_exec($curl); | |
} | |
} | |
// Uzavření spojení | |
curl_close($curl); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Automatické prodloužení inzerátů na MIDI.cz | |
*/ | |
define('LOGIN', ''); | |
define('PASS', ''); | |
// Základní nastavení a přihlášení | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_COOKIEJAR, dirname(__FILE__) .'/cookie-midi.txt'); | |
curl_setopt($curl, CURLOPT_URL, "http://www.midi.cz/"); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); | |
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE); | |
curl_setopt($curl, CURLOPT_AUTOREFERER, TRUE); | |
curl_setopt($curl, CURLOPT_TIMEOUT, 10); | |
curl_setopt($curl, CURLOPT_POST, 1); | |
curl_setopt($curl, CURLOPT_POSTFIELDS, array("prihlasit" => "1", "login" => LOGIN, "heslo" => PASS)); | |
curl_exec($curl); | |
// Načtení stránky "Moje inzeráty" | |
curl_setopt($curl, CURLOPT_URL, "http://www.midi.cz/me-inzeraty/"); | |
$contents = curl_exec($curl); | |
// Zjištění odkazů a prodloužení | |
if(preg_match_all("/\"\?odeslat_znovu=([0-9]+)\"/", $contents, $matches)) { | |
foreach($matches[1] as $idInzeratu) { | |
curl_setopt($curl, CURLOPT_URL, "http://www.midi.cz/me-inzeraty/?odeslat_znovu=".$idInzeratu); | |
curl_exec($curl); | |
} | |
} | |
// Uzavření spojení | |
curl_close($curl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment