Example #1
1
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Log::info('========== Delete post ==========');
     $params = array('id' => $id);
     Log::info('Inputs', $params);
     $url = 'http://www.candychat.net/ajax.php?t=post&a=delete&post_id=' . $id . "&token=" . $this->api_token . "&user_id=" . $this->user->id . "&user_pass="******"&timeline_id=" . $this->user->id;
     $api_response = cURL::get($url);
     Log::info('Result', $api_response->toArray());
     //$response = substr($api_response->body, 10,3);
     $json = json_decode($api_response->body, true);
     if ($json['status'] == 200) {
         return Response::json(array('status' => '1', 'response_code' => 'Delete Success'));
     } else {
         return Response::json(array('status' => '0', 'response_code' => 'Delete Incomplete', 'debug' => $json));
     }
 }
Example #2
1
function get_attr_profile_openid($type)
{
    if ($type == 'google') {
        include_once 'application/libraries/eac_curl.class.php';
        $options = array();
        $options['CURLOPT_AUTOREFERER'] = 1;
        $options['CURLOPT_CRLF'] = 1;
        $options['CURLOPT_NOPROGRESS'] = 1;
        $http = new cURL($options);
        $http->setOptions($options);
        $src = $http->get("https://www.googleapis.com/oauth2/v1/userinfo?access_token=" . $_GET['access_token']);
        $contact = $http->get("https://www.google.com/m8/feeds/contacts/default/full?max-results=5000&oauth_token=" . $_GET['access_token']);
        $xml = new SimpleXMLElement($contact);
        $xml->registerXPathNamespace('gd', 'http://schemas.google.com/g/2005');
        $result = $xml->xpath('//gd:email');
        $profile = json_decode($src);
        $info['type'] = 'google';
        if (isset($profile->id)) {
            $info['id'] = $profile->id;
        } else {
            $info['id'] = '';
        }
        if ($profile->email) {
            $info['email'] = $profile->email;
        } else {
            $info['email'] = '';
        }
        if ($profile->verified_email) {
            $info['verified_email'] = $profile->verified_email;
        } else {
            $info['verified_email'] = '';
        }
        if ($profile->name) {
            $info['full_name'] = $profile->name;
        } else {
            $info['full_name'] = '';
        }
        if ($profile->given_name) {
            $info['f_name'] = $profile->given_name;
        } else {
            $info['f_name'] = '';
        }
        if ($profile->family_name) {
            $info['l_name'] = $profile->family_name;
        } else {
            $info['l_name'] = '';
        }
        if (isset($profile->picture)) {
            $info['avatar'] = $profile->picture;
        } else {
            $info['avatar'] = '';
        }
        if (isset($profile->locale)) {
            $info['locale'] = $profile->locale;
        } else {
            $info['locale'] = '';
        }
        if (isset($profile->timezone)) {
            $info['timezone'] = $profile->timezone;
        } else {
            $info['timezone'] = '';
        }
        if (isset($profile->gender)) {
            $info['gender'] = $profile->gender;
        } else {
            $info['gender'] = '';
        }
        foreach ($result as $title) {
            $info['contact'][] = $title->attributes()->address;
        }
    } elseif ($type == 'yahoo') {
        $info['type'] = 'yahoo';
        if (isset($_REQUEST['openid_ax_value_email'])) {
            $info['email'] = $_REQUEST['openid_ax_value_email'];
        } else {
            $info['email'] = '';
        }
        if (isset($_REQUEST['openid_ax_value_fullname'])) {
            $info['full_name'] = $_REQUEST['openid_ax_value_fullname'];
        } else {
            $info['full_name'] = '';
        }
        if (isset($_REQUEST['openid_ax_value_nickname'])) {
            $info['nick_name'] = $_REQUEST['openid_ax_value_nickname'];
        } else {
            $info['nick_name'] = '';
        }
        if (isset($_REQUEST['openid_ax_value_gender'])) {
            $info['gender'] = $_REQUEST['openid_ax_value_gender'];
        } else {
            $info['gender'] = '';
        }
        if (isset($_REQUEST['openid_ax_value_image'])) {
            $info['avatar'] = $_REQUEST['openid_ax_value_image'];
        } else {
            $info['avatar'] = '';
        }
    } else {
        $facebook = new Facebook(array('appId' => FB_CLIENT_ID, 'secret' => FB_CLIENT_SECRET));
        $user_id = $facebook->getUser();
        if ($user_id) {
            $user_info = $facebook->api('/me');
            $list_firend = $facebook->api('/me/friends');
            $info['type'] = 'facebook';
            $info['uid'] = $user_info['id'];
            $info['email'] = $user_info['email'];
            $info['full_name'] = $user_info['name'];
            $info['list_firend'] = $list_firend;
        }
    }
    return $info;
}
Example #3
0
function shouldScrapeByTerm($term)
{
    $cc = new cURL();
    $output = $cc->get('http://www.nyu.edu/registrar/listings/');
    $output = substring($output, 'Course data was last updated on ', '<form method="post" name="selForm" action="results.html">', true);
    $date = substr($output, 0, strlen($output) - 5);
    $scrapeDate = date('Y-m-d H:i:s', strtotime($date));
    $sql = 'SELECT * FROM `nyu_courses_settings`';
    $result = mysql_query($sql);
    $row = mysql_fetch_assoc($result);
    if (!(stripos($term, "Fall") === false)) {
        $column = "latest_fall_scrape";
    } else {
        if (!(stripos($term, "Spring") === false)) {
            $column = "latest_spring_scrape";
        } else {
            if (!(stripos($term, "Winter") === false)) {
                $column = "latest_ws_scrape";
            } else {
                if (!(stripos($term, "Summer") === false)) {
                    $column = "latest_ws_scrape";
                }
            }
        }
    }
    if ($row[$column] != $scrapeDate) {
        scrape($term, $scrapeDate);
        deleteOldData($term, $scrapeDate);
        $sql = "UPDATE `nyu_courses_settings` SET `{$column}` = '{$scrapeDate}'";
        mysql_query($sql);
    }
}
 public function movie($id)
 {
     $url = "https://yts.re/api/movie.json?id=" . $id;
     if (Cache::has($url)) {
         return Cache::get($url);
     } else {
         $response = cURL::get($url);
         Cache::put($url, $response->body, 60);
         return $response->body;
     }
 }
Example #5
0
 /**
  * Show all post regarding to user id.
  * @return Response
  */
 public function conversationList($id)
 {
     $url = "https://chat.vdomax.com:1313/api/chat/list/" . $id;
     $response = cURL::get($url);
     $response = $response->body;
     $json = json_decode($response, true);
     if (count($json) != 0) {
         return Response::json(array('status' => '1', 'conversations' => $json));
     } else {
         return Response::json(array('status' => '0', 'conversations' => $json));
     }
 }
 /**
  * Scrape URL
  *
  * Loads down a page of HTML, and runs it against a regex expression.
  * The results are retuned as an array, or as an object if matched names are provided.
  *
  * @param String $url 			The complete URL to the target page (http://www.example.com/)
  * @param String $regex			The regex pattern to test against
  * @param Array 	$match_names	An array of strings that will become the names of the object properties
  * @param Array 	$options		Any additional options for cURL
  *
  * NB: $match_names need to be in the same order as the parenthesised sections of the regex pattern
  * (eg. array( 'foo', 'bar' ) will become $object->foo, $object->bar, in that order)
  */
 static function scrape_url($url = '', $regex = '', $match_names = NULL, $options = NULL)
 {
     //create cURL class
     require_once 'curl.class.php';
     $curl = new cURL();
     //insert any additional options into cURL
     if (is_array($options)) {
         $curl->options($options);
     }
     //grab the HTML data
     $html = $curl->get($url);
     //scrape HTML
     return PageScraper::scrape_html($html, $regex, $match_names);
 }
Example #7
0
 function mapSearch_($in)
 {
     $mapOptions = array('keyword' => $in['keyword']);
     $url = cURL::buildUrl('http://church.oursweb.net/lite/mapsearch', $mapOptions);
     $rdata = cURL::get($url);
     $data = json_decode($rdata, true);
     $body = $data['geoinfo'];
     return $body;
 }
Example #8
0
 $nahled = "http://navratdoreality.cz" . $t2[0];
 $t1 = explode('title="', $video);
 $t2 = explode('"', $t1[1]);
 $titulek = $t2[0];
 $t1 = explode('<br />hodnocení <span>', $video);
 $t2 = explode('</span>', $t1[1]);
 $hodnoceni = $t2[0];
 $t1 = explode('<br />shlédnuto <span>', $video);
 $t2 = explode('</span>', $t1[1]);
 $pocet = $t2[0];
 $t1 = explode('<div class="popis"><div>', $video);
 $t2 = explode('</div>', $t1[1]);
 $popis_bad = $t2[0];
 $popis = str_replace(array('<b>', '</b>', '<br />'), array('', '', ''), $popis_bad);
 $a = new cURL();
 $html2 = $a->get($linktoparse);
 $t1 = explode('"file","', $html2);
 $t2 = explode('"', $t1[1]);
 $link = "http://navratdoreality.cz/" . $t2[0];
 $find = ".flv";
 $find2 = ".mp4";
 $pos = strpos($link, $find);
 $pos2 = strpos($link, $find2);
 if ($pos === false and $pos2 === false) {
     $tit = "";
 } else {
     echo '
 <item>
 <title>' . $titulek . '</title>
 <onClick>
 <script>
Example #9
0
		<idleImage><?php 
echo $DIR_SCRIPT_ROOT;
?>
image/busy9.png</idleImage>
		</mediaDisplay>

	</item_template>
<channel>
	<title>Weeb.tv</title>
	<menu>main menu</menu>
<?php 
$disk = $_GET["disk"];
$cc = new cURL();
ReadSettings();
LogIn();
$html = $cc->get("http://weeb.tv/channels/live");
$videos = explode('<fieldset onclick', $html);
unset($videos[0]);
$videos = array_values($videos);
foreach ($videos as $video) {
    $t1 = explode('<a href="', $video);
    $t2 = explode('"', $t1[1]);
    $lnk = $t2[0];
    $t1 = explode('<img src="', $video);
    $t2 = explode('"', $t1[1]);
    $image = $t2[0];
    $t1 = explode('">', $video);
    $t2 = explode('</a></p>', $t1[5]);
    $title = $t2[0];
    echo '
    <item>
Example #10
0
function generic($u, $t, $r = null)
{
    $cc = new cURL();
    if (preg_match('@(.+?\\.[a-z]{2,4}/)(.+?/)embed@', $u, $m)) {
        if ($r != null) {
            $cc->headers[] = "Referer: {$r}";
        }
        $ff = $cc->get($u);
        if (preg_match('@[\'"](.*?m3u8.*?)[\'"]@', $ff, $mm)) {
            if (preg_match('@^http@', $mm[1])) {
                $tmp = $mm[1];
            } elseif ($mm[1][0] == "/") {
                $tmp = $m[1] . ltrim($mm[1], "/");
            } else {
                $tmp = $m[1] . $m[2] . $mm[1];
            }
            livestreamer_cmd($tmp, $t, array("Referer" => $r));
        } elseif (preg_match('@[\'"]{0,1}streamer[\'"]{0,1} *= *[\'"](rtmp:.*?)[\'"]@', $ff, $mm)) {
            $url = $mm[1];
            if (preg_match('@[\'"]{0,1}file[\'"]{0,1} *= *[\'"](.*?)[\'"]@', $ff, $mmm)) {
                $url .= $mmm[1];
            }
            rtmpdump_cmd($url, $t);
        } else {
            offline();
            stf($ff);
        }
    } else {
        echo "{$u}: no match...\r\n";
    }
}
Example #11
0
 public function video()
 {
     $params = Input::all();
     if (isset($params['user_id'])) {
         $user_id = "&user_id=" . $params['user_id'];
     } else {
         $user_id = "";
     }
     if (!isset($params['q'])) {
         $params['q'] = "";
     }
     if (!isset($params['sort'])) {
         $sort = "N";
     } else {
         $sort = $params['sort'];
     }
     if (!isset($params['page'])) {
         $page = 1;
     } else {
         $page = $params['page'];
     }
     if (!isset($params['limit'])) {
         $params['limit'] = 20;
     }
     if (!isset($params['page'])) {
         $params['from'] = 0;
     } else {
         if ($page == 1) {
             $params['from'] = 0;
         } else {
             $params['from'] = ($page - 1) * $params['limit'] + 1;
         }
     }
     $url = "https://www.vdomax.com/ajax.php?t=getVideo&mobile=1&query=" . $params['q'] . "&from=" . $params['from'] . "&limit=" . $params['limit'] . "&sort=" . $sort . $user_id;
     $response = cURL::get($url, $params);
     $response = $response->body;
     $json = json_decode($response, true);
     if (count($json) != 0) {
         return Response::json(array('status' => '1', 'page' => (int) $page, 'per_page' => (int) $params['limit'], 'pages' => ceil(count($json) / $params['limit']), 'total' => count($json), 'sort' => $sort, 'debug' => $url, 'videos' => $json));
     } else {
         return Response::json(array('status' => '0', 'page' => (int) $page, 'per_page' => (int) $params['limit'], 'pages' => ceil(count($json) / $params['limit']), 'total' => count($json), 'sort' => $sort, 'videos' => $json, 'debug' => $url));
     }
 }
Example #12
0
        curl_setopt($process, CURLOPT_POST, 1);
        $return = curl_exec($process);
        curl_close($process);
        return $return;
    }
    function error($error)
    {
        echo "cURL Error : {$error}";
        die;
    }
}
$URL = $_GET["url"];
echo "<?xml version='1.0' ?>\n";
echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
$cc = new cURL();
$html = $cc->get($url);
$t1 = explode("<script>window.location='", $html);
$t2 = explode("'", $t1[1]);
$link = $t2[0];
if (($html = openpage($link)) != FALSE) {
    $ItemsOut .= "<channel>\n<title>Uloz.to</title>";
    $t1 = explode('<img style="width:175px; height:70px;" width="175" height="70" src="', $html);
    $t2 = explode('"', $t1[1]);
    $nahled1 = $t2[0];
    $t1 = explode('captcha/', $nahled1);
    $t2 = explode('.png', $t1[1]);
    $nahled = $t2[0];
    $ItemsOut .= "\r\n\t\t\t<item>\r\n\t\t\t\t<title>Zadej kod z obrazku</title>\r\n\t\t\t\t<link>rss_command://search</link>\r\n\t\t\t\t<search url=\"http://127.0.0.1/media/sda1/scripts/xLiveCZ/ulozto/ulozto_link_final.php?query=%s," . $nahled . "," . $link . "\" />\r\n\t\t\t\t<media:thumbnail url=\"" . $nahled1 . "\" />\r\n\t\t\t</item>\n";
    $ItemsOut .= "</channel>\n</rss>";
    echo $ItemsOut;
} else {
Example #13
0
 /**
  * Display suggestion list.
  *
  * @return Response
  */
 public function follow_suggestion($userId)
 {
     $user = Account::find($userId);
     $url = "";
     //if($user != null)
     $url = 'http://candychat.net/request.php?t=search&a=follow-suggestions-mobile&user_id=' . $user->id . "&user_pass="******"&token=asdffdsa&q=a";
     $api_response = cURL::get($url);
     $response = $api_response->toArray();
     $response = $response['body'];
     $json = json_decode($response, true);
     //return Response::json($json);
     $total_account = sizeof($json["suggestion"]);
     $users = array();
     foreach ($json["suggestion"] as $user) {
         $the_user = Account::find((int) $user["id"]);
         $the_user->avatar;
         $the_user->cover;
         $the_user->gender;
         $the_user->birthday;
         $the_user->is_following = Helpers::SK_isFollowing($the_user->id, $userId);
         $users[] = $the_user;
     }
     $response = array('status' => '1', 'total' => $total_account, 'users' => $users);
     return Response::json($response);
 }
Example #14
0
<?php

require '../cURL.php';
$client = new cURL();
$client->get('action', 'login');
$client->post('username', 'admin')->post('password', 'admin');
echo $client->navigate('http://localhost/uvt/curl/example/test.php');
Example #15
0
<?php

session_start();
include 'curl.php';
include 'config.php';
$curl = new cURL();
$html = $curl->get('https://daa.uit.edu.vn');
if (!isset($form_build_id)) {
    if (preg_match('<input type="hidden" name="form_build_id" value="(.*?)" />', $html, $matches)) {
        $form_build_id = $matches[1];
    } else {
        echo "Error getting form_build_id";
    }
    echo $form_build_id;
}
do {
    $daa_login = $curl->post('https://daa.uit.edu.vn/user/login%26homepage?destination=node', 'name=' . $config['id'] . '&pass='******'password'] . '&form_build_id=' . $form_build_id . '&form_id=user_login_block&op=%C4%90%C4%83ng+nh%E1%BA%ADp');
    if (preg_match('<input type="hidden" name="form_build_id" value="(.*?)" />', $daa_login, $matches)) {
        $form_build_id = $matches[1];
    } else {
        echo "Error getting form_build_id";
        exit;
    }
    ++$config['password'];
    $config['password'] = '******' . $config['password'];
    //$kqht = $curl->get('https://daa.uit.edu.vn/sinhvien/kqhoctap');
    //echo $kqht;
} while (!preg_match('#<h2>Thông Tin Tài Khoản</h2>#', $daa_login, $matches2));
$kqht = $curl->get('https://daa.uit.edu.vn/sinhvien/kqhoctap');
echo $config['password'];
echo $kqht;
Example #16
0
        curl_setopt($p, CURLOPT_ENCODING, $this->compression);
        curl_setopt($p, CURLOPT_TIMEOUT, 30);
        curl_setopt($p, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($p, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($p, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($p, CURLOPT_SSL_VERIFYHOST, 0);
        $return = curl_exec($p);
        if ($return !== false) {
            $this->status = curl_getinfo($p, CURLINFO_HTTP_CODE);
        }
        curl_close($p);
        return $return;
    }
}
$cc = new cURL();
$file = $cc->get('http://streamking.cc/');
preg_match_all('@href="/(.+?)"><img.*?title="(.+?)"@', $file, $mtc_array);
$title_array = $mtc_array[2];
$chn_array = $mtc_array[1];
$play_array = preg_replace('@^(.+?)$@', 'http://streamking.cc/player?channel=$1', $chn_array);
while (true) {
    echo "\r\nLista canali:\r\n\r\n";
    for ($i = 0; $i < count($title_array); $i++) {
        //Cyrillic not displayed correctly
        $tmp = !isRussian($title_array[$i]) ? $title_array[$i] : $chn_array[$i];
        echo "{$i}) " . $tmp . (($i + 1) % 2 == 0 ? "\r\n" : str_repeat(' ', 25 - strlen($tmp . $i)));
    }
    echo "\r\n\r\nScegli il canale (x=Uscita): ";
    $inp = trim(fgets(STDIN));
    if ($inp >= count($title_array) || !preg_match('@[0-9xX]@', $inp)) {
        echo "\r\nScelta non valida!\r\n";
Example #17
0
         } else {
             debug("  Не удалось получить Activity Hash!");
             continue;
         }
     }
 } else {
     if (!$data[$v[0]]['ahash']) {
         continue;
     }
 }
 $ch_twi->auth = "{$v['2']}:{$v['3']}";
 //Задаем логин и пароль для твиттера
 //Если еще ни один твит не транслировали
 if (!$data[$v[0]]['lastid']) {
     debug(" Транслируем первый твит...");
     $r = $ch_twi->get("http://twitter.com/statuses/user_timeline/{$v['2']}.xml?count=1");
     //Получаем ид последнего твита, текст и сорс
     if (!$r) {
         debug("Не удалось получить список твитов!");
         continue;
     }
     $d = new SimpleXMLElement($r);
     if ($d->status) {
         $data[$v[0]]['lastid'] = (string) $d->status->id;
         //Записываем ид последнего твита
         vk_status($d->status->text, $d->status->source, $data[$v[0]]['ahash']);
         debug(" ok.");
     }
 } else {
     debug(" Ищем новые твиты...");
     $r = $ch_twi->get("http://twitter.com/statuses/user_timeline/{$v['2']}.xml?since_id=" . $data[$v[0]]['lastid']);
    }
}
//http://195.128.78.52/SPFB.SBRF_130928_130929.txt?market=14&em=17456&code=SPFB.SBRF&df=28&mf=8&yf=2013&dt=29&mt=8&yt=2013&p=1&f=SPFB.SBRF_130928_130929&e=.txt&cn=SPFB.SBRF&dtf=1&tmf=1&MSOR=0&mstime=on&mstimever=1&sep=3&sep2=1&datf=9
$postParams = array('df' => intval($_POST['df']), 'mf' => intval($_POST['mf']) - 1, 'yf' => intval($_POST['yf']), 'dt' => intval($_POST['ds']), 'mt' => intval($_POST['ms']) - 1, 'yt' => intval($_POST['ys']), 'fileName' => $codes[$active] . '_' . mb_substr($_POST['ys'], 2, 2) . sprintf("%02s", intval($_POST['ms'])) . sprintf("%02s", intval($_POST['ds'])) . '_' . mb_substr($_POST['yf'], 2, 2) . sprintf("%02s", intval($_POST['mf'])) . sprintf("%02s", intval($_POST['df'])));
$fileName = 'http://195.128.78.52/';
$dataString = sprintf("%02s", intval($_POST['ds'])) . '.' . sprintf("%02s", intval($_POST['ms'])) . '.' . $_POST['ys'];
$time = mktime(0, 0, 0, intval($_POST['ms']), intval($_POST['ds']), intval($_POST['ys']));
$additionalString = 'Active: ' . $active . '. Date: ' . date('D', $time) . ', ' . $dataString . '. <a href="#" class="tradesReloadLink" data-active="' . $active . '" data-day="' . $_POST['ds'] . '" data-month="' . $_POST['ms'] . '" data-year="' . $_POST['ys'] . '">Reload</a>.';
$params = array('market' => $markets[$active], 'em' => $ems[$active], 'code' => $codes[$active], 'df' => $postParams['df'], 'mf' => $postParams['mf'], 'yf' => $postParams['yf'], 'dt' => $postParams['dt'], 'mt' => $postParams['mt'], 'yt' => $postParams['yt'], 'p' => 1, 'f' => $postParams['fileName'], 'e' => '.txt', 'cn' => 'SPFB.' . $active, 'dtf' => 1, 'tmf' => 1, 'MSOR' => 0, 'mstime' => 'on', 'mstimever' => 1, 'sep' => 3, 'sep2' => 1, 'datf' => 9);
$fileName .= $params['f'] . $params['e'] . '?' . http_build_query($params);
$notifications = array();
//var_dump($fileName);
try {
    $cc = new cURL();
    //    var_dump($cc);
    $trades = $cc->get($fileName);
    //    var_dump($trades);
    //    $trades = file_get_contents($fileName);
    //    echo $trades;
    // Здесь анализ trades
    if ($trades) {
        $tradesStrings = explode("\n", trim(trim($trades), "\n"));
        $notificationMessages = array();
        if (count($tradesStrings) < 10) {
            $notificationMessages[] = 'Too few lines in the file!';
        }
        if (count($tradesStrings) > 1) {
            $firstString = $tradesStrings[0];
            $lastString = $tradesStrings[count($tradesStrings) - 1];
            $firstStringParts = explode(';', $firstString);
            $lastStringParts = explode(';', $lastString);
Example #19
0
 function UpdateBootstrapInfo(cURL $cc, $bootstrapUrl)
 {
     $fragNum = $this->fragCount;
     $retries = 0;
     // Backup original headers and add no-cache directive for fresh bootstrap info
     $headers = $cc->headers;
     $cc->headers[] = "Cache-Control: no-cache";
     $cc->headers[] = "Pragma: no-cache";
     while ($fragNum == $this->fragCount and $retries < 30) {
         $bootstrapPos = 0;
         LogDebug("Updating bootstrap info, Available fragments: " . $this->fragCount);
         $status = $cc->get($bootstrapUrl);
         if ($status != 200) {
             LogError("Failed to refresh bootstrap info, Status: " . $status);
         }
         $bootstrapInfo = $cc->response;
         ReadBoxHeader($bootstrapInfo, $bootstrapPos, $boxType, $boxSize);
         if ($boxType == "abst") {
             $this->ParseBootstrapBox($bootstrapInfo, $bootstrapPos);
         } else {
             LogError("Failed to parse bootstrap info");
         }
         LogDebug("Update complete, Available fragments: " . $this->fragCount);
         if ($fragNum == $this->fragCount) {
             LogInfo("Updating bootstrap info, Retries: " . ++$retries, true);
             usleep(4000000);
         }
     }
     // Restore original headers
     $cc->headers = $headers;
 }
<?php

set_time_limit(0);
error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once 'class.curl.inc.php';
require_once 'simple_html_dom.php';
require_once 'simple_html_dom_node.php';
$curler = new cURL();
$html = $curler->get('http://www.magento-stammtisch.de/');
$objHtml = str_get_html($html);
$filename = 'irc-bot-stammtisch-dates.json';
if (!file_exists($filename)) {
    file_put_contents($filename, json_encode(array()));
}
$posts = $objHtml->find('div.postlist div.post');
$postsFound = count($posts);
$stammtische = array();
foreach ($posts as $post) {
    /** @var simple_html_dom_node $post */
    /** @var simple_html_dom_node $find */
    $find = $post->find('div.date', 0);
    $stammtischNum = (int) $find->innertext();
    $stammtische[$stammtischNum] = array();
    $find = $post->find('div.entry h3.entry-title span', 0);
    $stammtische[$stammtischNum]['title'] = $find->innertext();
    $find = $post->find('div.entry p[0] time', 0);
    $stammtische[$stammtischNum]['time'] = $find->innertext();
    $find = $post->find('div.entry p[0] a', 0);
    $stammtische[$stammtischNum]['locationLink'] = $find->href;
    $locationName = $find->find('span', 0);
Example #21
0
 /**
  * Show all post regarding to user id.
  * @return Response
  */
 public function history_deprecated($id)
 {
     //return Post::getHistory(array($id), $this->page, $this->per_page, $this->type);
     Log::info('========== Follow post ==========');
     $params = array('id' => $id);
     $user = Account::find($id);
     //$user->birthday;
     //$user->gender;
     //$user->avatar;
     //$user->cover;
     $url = 'http://server-a.vdomax.com:8080/record/?user='******'body'];
     //$json["sample_url"] = "http://server-a.vdomax.com:8080/record/youlove-310115_23:59:46.flv";
     $history = json_decode($response, true);
     $data = [];
     $tmp = [];
     $i = 0;
     if ($history != null) {
         foreach ($history as $obj) {
             $liveId = Helpers::SK_getLiveHistoryId($obj['name']);
             $tmp['user_id'] = $id . "";
             $tmp['username'] = $user->username;
             $tmp['avatar'] = "https://www.vdomax.com/" . $user->avatar;
             $tmp['last_thumb'] = "https://www.vdomax.com/clips/rtmp/" . $user->username . ".png";
             //$tmp['url'] = "http://server-a.vdomax.com:8080/record/".$obj['name'].".flv";
             $tmp['url'] = "http://stream-1.vdomax.com:1935/vod/__definst__/mp4:" . $user->username . "/" . $user->username . "_xxx_" . $liveId . ".mp4/playlist.m3u8";
             //$tmp['transcode'] = "http://server-a.vdomax.com:8080/record/transcode/".$obj['name'].".flv-480x272.mp4";
             $tmp['thumb'] = "http://server-a.vdomax.com:8080/record/" . $obj['name'] . ".flv.png";
             $tmp['name'] = $obj['name'];
             $tmp['duration'] = $obj['duration'];
             $tmp['date'] = $obj['date'];
             if (isset($liveId)) {
                 $data[] = $tmp;
             }
         }
     } else {
         $data = null;
     }
     $json['count'] = count($data);
     $json['history'] = $data;
     return Response::json($json);
 }
Example #22
0
define('ROOT', dirname(__FILE__));
include_once ROOT . '/lib/define.php';
$page_title = 'New URL';
$page_url = $_SERVER['PHP_SELF'];
// If creating a new URL
if (isset($_POST['submit'])) {
    // Make sure this is a valid URL
    $url_valid = false;
    $url_params = $_POST;
    if (substr(trim($_POST['url']), 0, 4) == 'http') {
        // Use CURL
        include_once ROOT . '/lib/curl/curl.php';
        $myCurl = new cURL();
        // Grab the homepage to get all the info about it
        $page = $myCurl->get(trim($_POST['url']), NULL, true);
        $title = 'Page: ' . $page['info']['url'];
        // If the page is returned successfully
        if ($page['info']['http_code'] == '200') {
            // Include the DOM functions
            include_once ROOT . '/lib/dom/simple_html_dom.php';
            // Grab the page title
            $html = str_get_html($page['response']);
            if (is_object($html)) {
                $title = trim($html->find('title', 0)->plaintext);
            }
        }
        // Setup the URL Params
        $url_params['url'] = $page['info']['url'];
        $url_params['title'] = $title;
        $url_valid = true;
Example #23
0
 function curlGet($url = '', $params = array(), $htpassInfo = '')
 {
     $options = array();
     $options['CURLOPT_AUTOREFERER'] = 1;
     $options['CURLOPT_CRLF'] = 1;
     $options['CURLOPT_NOPROGRESS'] = 1;
     //login htpaswd
     if ($htpassInfo) {
         $options['CURLOPT_USERPWD'] = $htpassInfo;
         $options['CURLOPT_HTTPAUTH'] = CURLAUTH_ANY;
     }
     $http = new cURL($options);
     $http->setOptions($options);
     if (substr($url, -1) != '?' && !empty($params)) {
         $url .= "?" . http_build_query($params);
     }
     $src = $http->get($url);
     return $src;
 }
Example #24
0
 public function page($id)
 {
     $params = Input::all();
     $url = "http://www.candychat.net/request.php?t=getLovedPage&id=" . $id . "&mobile_api=1";
     $response = cURL::get($url);
     $response = $response->body;
     $json = json_decode($response, true);
     if (count($json) != 0) {
         return Response::json(array('status' => '1', 'count' => count($json), 'user_id' => $id, 'page' => $json));
     } else {
         return Response::json(array('status' => '0', 'count' => count($json), 'user_id' => $id, 'page' => $json));
     }
 }
Example #25
0
            curl_setopt($process, CURLOPT_PROXY, $this->proxy);
        }
        curl_setopt($process, CURLOPT_POSTFIELDS, $data);
        curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($process, CURLOPT_POST, 1);
        $return = curl_exec($process);
        curl_close($process);
        return $return;
    }
    function error($error)
    {
        echo "cURL Error : {$error}";
        die;
    }
}
$URL = $_GET["url"];
echo "<?xml version='1.0' encoding='utf-8' ?>\n";
echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
$h = new cURL();
$html = $h->get($URL);
$ItemsOut .= "<channel>\n<title>Uloz.to</title>";
$t1 = explode('{ url: "', $html);
$t2 = explode('"', $t1[1]);
$link = $t2[0];
$t1 = explode('<title>', $html);
$t2 = explode(' |', $t1[1]);
$titulek = $t2[0];
$ItemsOut .= "\r\n\t\t\t<item>\r\n\t\t\t\t<title>Přehrát: <![CDATA[" . $titulek . "]]></title>\r\n\t\t\t\t<link>" . $link . "</link>\r\n\t\t\t\t<pubDate>Potvrďte pro začátek přehrávání</pubDate>\r\n\t\t\t\t<enclosure type=\"video/mp4\" url=\"" . $link . "\"/>\r\n\t\t\t</item>\n";
$ItemsOut .= "</channel>\n</rss>";
echo $ItemsOut;
Example #26
0
<?php

include '../../inc/init.inc';
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
//ini_set('display_errors', 0);
$url = urldecode($_GET['url']);
$url = Request::checkValues($url);
$return_array = array();
$base_url = substr($url, 0, strpos($url, "/", 8));
$relative_url = substr($url, 0, strrpos($url, "/") + 1);
// Get Data
$cc = new cURL(false);
$string = $cc->get($url);
$string = str_replace(array("\n", "\r", "\t", '</span>', '</div>'), '', $string);
$string = preg_replace('/(<(div|span)\\s[^>]+\\s?>)/', '', $string);
if (mb_detect_encoding($string, "UTF-8") != "UTF-8") {
    $string = utf8_encode($string);
}
// Parse Title
$nodes = Request::extract_tags($string, 'title');
$return_array['title'] = trim($nodes[0]['contents']);
// Parse Base
$base_override = false;
$base_regex = '/<base[^>]*' . 'href=[\\"|\'](.*)[\\"|\']/Ui';
preg_match_all($base_regex, $string, $base_match, PREG_PATTERN_ORDER);
if (strlen($base_match[1][0]) > 0) {
    $base_url = $base_match[1][0];
    $base_override = true;
}
// Parse Description
$return_array['description'] = '';
Example #27
0
            curl_setopt($process, CURLOPT_PROXY, $this->proxy);
        }
        curl_setopt($process, CURLOPT_POSTFIELDS, $data);
        curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($process, CURLOPT_FOLLOWLOCATION, TRUE);
        curl_setopt($process, CURLOPT_POST, TRUE);
        $return = curl_exec($process);
        curl_close($process);
        return $return;
    }
}
// EXAMPLE:
/*
$options = array
(
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
);
$cc = new cURL($options); 
*/
$cc = new cURL();
$tss1 = $cc->get('http://www.healthspace.ca/Clients/VDH/LFairfax/LFairfax_Website.nsf/Food-FacilityHistory?OpenView&RestrictToCategory=57727DA855A77D1E85257508007515D7');
/*
$parameters = array
(
    'foo' => 'bar'
);
$cc->post('http://www.example.com', $parameters); 
*/
#$cc->post('http://www.example.com','foo=bar');
echo $tss1;
    $referrer = $cli->getParam('referrer');
}
if ($cli->getParam('start')) {
    $start = $cli->getParam('start');
}
if ($cli->getParam('useragent')) {
    $cc->user_agent = $cli->getParam('useragent');
}
// Use custom referrer
if ($referrer) {
    $cc->headers[] = "Referer: " . $referrer;
}
// Update the script
if ($update) {
    LogInfo("Updating script....");
    $status = $cc->get("https://raw.github.com/K-S-V/Scripts/master/AdobeHDS.php");
    if ($status == 200) {
        if (md5($cc->response) == md5(file_get_contents($argv[0]))) {
            LogError("You are already using the latest version of this script.", 0);
        }
        $status = file_put_contents($argv[0], $cc->response);
        if (!$status) {
            LogError("Failed to write script file");
        }
        LogError("Script has been updated successfully.", 0);
    } else {
        LogError("Failed to update script");
    }
}
// Set overall maximum bandwidth for fragment downloading
if ($maxSpeed > 0) {
<?php

set_time_limit(0);
error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once 'class.curl.inc.php';
require_once 'simple_html_dom.php';
require_once 'simple_html_dom_node.php';
$curler = new cURL();
$html = $curler->get('http://zitate.net/');
$objHtml = str_get_html($html);
$filename = 'irc-bot-annoy-quotes.json';
if (!file_exists($filename)) {
    file_put_contents($filename, json_encode(array()));
}
$quotes = json_decode(file_get_contents($filename), true);
$max = 150;
for ($i = 0; $i < $max; $i++) {
    echo $i . DIRECTORY_SEPARATOR . $max . ' (' . count($quotes) . ')' . PHP_EOL;
    $html = $curler->get('http://zitate.net/');
    $objHtml = str_get_html($html);
    $posts = $objHtml->find('span.quote-quote');
    foreach ($posts as $post) {
        /** @var simple_html_dom_node $post */
        $quote = strip_tags($post->innertext());
        $qmd5 = md5($quote);
        if (!array_key_exists($qmd5, $quotes)) {
            echo $quote . PHP_EOL;
            $quotes[$qmd5] = $quote;
        }
    }
Example #30
-1
 /**
  * Display suggestion list.
  *
  * @return Response
  */
 public function follow_suggestion()
 {
     $url = 'https://www.vdomax.com/ajax.php?t=search&a=follow-suggestions-mobile&user_id=' . $this->user->id . "&user_pass="******"&token=" . $this->api_token;
     $api_response = cURL::get($url);
     $response = $api_response->toArray();
     $response = $response['body'];
     $json = json_decode($response, true);
     //return Response::json($json);
     $total_account = sizeof($json["suggestion"]);
     $response = array('status' => '1', 'total' => $total_account, 'users' => $json["suggestion"]);
     return Response::json($response);
 }