Beispiel #1
0
    //infocurl2($ch);//дає всю інформацю про курл інфож
    echo curl_error($ch);
    if (curl_errno($ch)) {
        echo 'Ошибка curl: ' . curl_errno($ch);
    }
    echo $html1 = str_get_html($result);
    curl_close($ch);
    return $mas;
}
$url2 = 'https://adm.tlscontact.com/ae2dk/login.php';
$url3 = 'https://adm.tlscontact.com/ae2dk/index.php?fg_id=4253314';
$url4 = 'https://adm.tlscontact.com/ae2dk/login.php?redir=%2Findex.php%3Ffg_id%3D4253314';
//$dom2=SendRequest($url,$header);
$redirect = location0($url2, $header2);
echo $redirect;
get_all_redirects($url2, $redirect);
//location3($url3,$header);
//location3($url4,$header2);
//location3($url3,$header);
//if($mas)
//{
//    location2($url2,$header,$mas);
////    location3($url2,$header);
//}
//$dom=location($url2,$header);
//    location3($url2,$header);
//var_dump($dom);
// var_dump($dom);
//    $input2=$dom->find("div[class=take_appointment] a[class=dispo]");
//    foreach($input2 as $span){
//
Beispiel #2
0
/**
 * get_final_url()
 * Gets the address that the URL ultimately leads to. 
 * Returns $url itself if it isn't a redirect.
 *
 * @param string $url
 * @return string
 */
function get_final_url($url)
{
    $redirects = get_all_redirects($url);
    if (count($redirects) > 0) {
        return array_pop($redirects);
    } else {
        return $url;
    }
}
Beispiel #3
0
function get_all_redirects($url, $location = array())
{
    $url = trim($url);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_COOKIEJAR, ".//my_cookies.txt");
    curl_setopt($ch, CURLOPT_COOKIEFILE, ".//my_cookies.txt");
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_NOBODY, true);
    curl_setopt($ch, CURLOPT_USERAGENT, 'MJ12bot');
    $html = curl_exec($ch);
    preg_match_all('/Location:(.*?)\\n/', $html, $matches);
    if (count($matches[1]) > 0) {
        $location[] = $matches[1][0];
        $location = get_all_redirects($matches[1][0], $location);
        return $location;
    } else {
        return $location;
    }
}
Beispiel #4
0
 function handler_mail($page)
 {
     global $globals;
     if ($globals->asso('disable_mails')) {
         return PL_FORBIDDEN;
     }
     $page->changeTpl('xnetgrp/mail.tpl');
     $mmlist = new MMList(S::user(), $globals->asso('mail_domain'));
     $page->assign('listes', $mmlist->get_lists());
     $page->assign('user', S::user());
     if (Post::has('send')) {
         S::assert_xsrf_token();
         $from = Post::v('from');
         $sujet = Post::v('sujet');
         $body = Post::v('body');
         $mls = array_keys(Env::v('ml', array()));
         $mbr = array_keys(Env::v('membres', array()));
         $this->load('mail.inc.php');
         set_time_limit(120);
         $tos = get_all_redirects($mbr, $mls, $mmlist);
         $upload = PlUpload::get($_FILES['uploaded'], S::user()->login(), 'xnet.emails', true);
         if (!$upload && @$_FILES['uploaded']['name'] && PlUpload::$lastError != null) {
             $page->trigError(PlUpload::$lastError);
             return;
         }
         send_xnet_mails($from, $sujet, $body, Env::v('wiki'), $tos, Post::v('replyto'), $upload, @$_FILES['uploaded']['name']);
         if ($upload) {
             $upload->rm();
         }
         $page->killSuccess("Email envoyé !");
         $page->assign('sent', true);
     }
 }