Example #1
0
function get_words()
{
    $url = 'http://cartoonbank.ru/ales/wordassociations/emotionslist.html';
    $contents = file_get_contents($url);
    $tag = "a";
    return getTextBetweenTags($tag, $contents, $strict = 0);
}
Example #2
0
 function handleDocumentInfo($DocInfo)
 {
     global $query;
     global $url;
     // Just detect linebreak for output ("\n" in CLI-mode, otherwise "<br>").
     if (PHP_SAPI == "cli") {
         $lb = "\n";
     } else {
         $lb = "<br />";
     }
     $before = "/(.*";
     $after = ".*)/";
     $q = $before . $query . $after;
     //$query= '/(.*diskriminaciju.*)/';
     preg_match($q, $DocInfo->content, $matches, PREG_OFFSET_CAPTURE, 3);
     if ($matches && $DocInfo->received == true) {
         echo "<div style='margin-left:10px'>";
         //$titlexpr="/<title[^>]*>(.*?)</title>/";
         //preg_match($titlexpr,$DocInfo->content,$sitetitle,PREG_OFFSET_CAPTURE, 3);
         $sitetitle = getTextBetweenTags($DocInfo->content, "title");
         echo "<a href='" . $DocInfo->url . "'> <h4>" . $sitetitle . "</h4></a>";
         echo "<p style='color:green;'>" . $DocInfo->url . " - (" . $url . ") </p>";
         $desc = implode("...", $matches[0]);
         $sitetitle = "~<[a-zA-Z]*>|</[a-zA-Z]*>~";
         preg_replace($sitetitle, " ", $desc);
         print_r($desc);
         echo "<hr style='color:border-top: 1px solid #aaaaaa;'>";
         echo "</div>";
     }
     // Now you should do something with the content of the actual
     // received page or file ($DocInfo->source), we skip it in this example
     flush();
 }
Example #3
0
function RSStoArray($xml)
{
    $items = preg_split('/<item[\\s|>]/', $xml, -1, PREG_SPLIT_NO_EMPTY);
    array_shift($items);
    $i = 0;
    foreach ($items as $item) {
        $array[$i]['title'] = getTextBetweenTags($item, 'title');
        $array[$i]['link'] = getTextBetweenTags($item, 'link');
        $array[$i]['description'] = getTextBetweenTags($item, 'description');
        $array[$i]['author'] = getTextBetweenTags($item, 'author');
        $array[$i]['category'] = getTextBetweenTags($item, 'category');
        $array[$i]['comments'] = getTextBetweenTags($item, 'comments');
        $array[$i]['enclosure'] = getTextBetweenTags($item, 'enclosure');
        $array[$i]['guid'] = getTextBetweenTags($item, 'guid');
        $array[$i]['pubDate'] = getTextBetweenTags($item, 'pubDate');
        $array[$i]['source'] = getTextBetweenTags($item, 'source');
        if (preg_match('/<img.*src=\\"?(http:\\/\\/.*\\.(jpg|gif|png))\\".*>/', $array[$i]['description']['data'], $match)) {
            $array[$i]['enclosure']['url'] = $match[1];
            $typies = array('jpg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png');
            $array[$i]['enclosure']['type'] = $typies[$match[2]];
        } else {
            $array[$i]['media:thumbnail'] = getTextBetweenTags($item, 'media:thumbnail');
            $array[$i]['enclosure'] = getTextBetweenTags($item, 'enclosure');
        }
        $array[$i]['description']['data'] = strip_tags($array[$i]['description']['data']);
        $i++;
    }
    return $array;
}
Example #4
0
function get_words($word)
{
    $url = 'http://wordassociations.ru/search?hl=ru&q=' . $word . '&button=%D0%9F%D0%BE%D0%B8%D1%81%D0%BA';
    $contents = file_get_contents($url);
    $tag = "a";
    return getTextBetweenTags($tag, $contents, $strict = 0);
}
Example #5
0
 function showQuestion()
 {
     $groupTemplate = $this->getTemplate()->getTemplateContent();
     //needs to have 'repeat'!!!
     $textwithoutrepeats = getTextBetweenTags($groupTemplate, 'repeat');
     //expecting repeat!!
     $showQuestion = $textwithoutrepeats[1];
     foreach ($this->getQuestions() as $question) {
         $patterns = array('/<question \\/>/');
         $replacements = array($question->showQuestion());
         $showQuestion .= preg_replace($patterns, $replacements, $textwithoutrepeats[2]);
     }
     $showQuestion .= $textwithoutrepeats[3];
     return $showQuestion;
 }
Example #6
0
function recurrsive($http_url)
{
    $eurl = str_replace("https:", "http:", "{$http_url}");
    $page = new DOMDocument();
    $url = html_entity_decode($eurl);
    @$page->loadHTMLFile($url);
    $pagestring = $page->saveHTML();
    $content2 = getTextBetweenTags($pagestring, 'title');
    echo $url;
    echo "{$content2}<br/>";
    foreach ($page->getElementsByTagName('a') as $links) {
        $original_url = $links->getAttribute('href');
        //echo "$original_url";
        //echo "$content2<br/>";
        recurrsive($original_url);
    }
}
    if (count($matches) > 0) {
        return str_replace('"', "", $matches[0]);
    }
    return '';
}
$id = trim($_GET['id']);
$explodeArray = explode("/", $id);
//print_r($explodeArray);
$userid = $explodeArray[1];
$boardname = $explodeArray[2];
$url = "http://pinterest.com/{$userid}/{$boardname}/";
$html = file_get_html($url);
$totalnumberofpage = '';
// Check for total number of pages.
foreach ($html->find('script') as $e) {
    $x = getTextBetweenTags($e);
    if ($x != '') {
        $totalnumberofpage = $x;
    }
}
if ($totalnumberofpage != '') {
    $arr = explode(":", $totalnumberofpage);
    $totalPages = trim($arr[1]);
} else {
    $totalPages = 1;
}
$rs = array();
$productName = '';
$productURL = '';
$productDomain = '';
$productImageURL = '';
    <div clasS="col-xs-12 nopadding">
       
    


 <?php 
$gallery = array();
$attachments = new Attachments('attachments', get_the_ID());
if ($attachments->exist()) {
    while ($attachments->get()) {
        array_push($gallery, $attachments->src('full'));
    }
}
//ottengo il contenuto
$post = get_page($pageID);
$content = getTextBetweenTags('p', apply_filters('the_content', $post->post_content));
//ottengo gli artisti
$pages = get_posts(array('post_type' => 'page', 'meta_key' => '_wp_page_template', 'meta_value' => 'page-artist.php'));
$artists = array();
foreach ($pages as $page) {
    $artist = array();
    $artist['image'] = wp_get_attachment_url(get_post_thumbnail_id($page->ID));
    $artist['page'] = $page->guid;
    $artist['name'] = $page->post_title;
    $artist['ruolo'] = get_post_meta($page->ID, 'ruolo', true);
    $artist['url'] = get_post_meta($page->ID, 'url', true);
    $artist['ID'] = $page->ID;
    $artist['linkTo'] = "";
    //imposto il link del redirect
    if ($pageID == $artist['ID']) {
        $artist['linkTo'] = $artist['url'];
						value="<?php 
        echo isset($q) ? $q : '';
        ?>
" />
					<input type="submit" name="search" class="button button-back" value="<?php 
        echo __('Search');
        ?>
" />
				</p>
			</form>
		</div>
<?php 
    } else {
        $info = $advanced === TRUE ? __('Advanced Search') : $info;
        if (strpos($info, 'div')) {
            $info = getTextBetweenTags('div', $info);
            $info = $info[0];
        }
        $title_bar = $info;
        ?>

		<div id="title-bar" class="title-bar">
			<div><?php 
        echo $title_bar;
        ?>
</div>
		</div>
<?php 
    }
    ?>
Example #10
0
  <h1>Create and edit blog entries</h1>
  
  <p>This is a very simple blog machine. On the first line, choose 
  &quot;Formats -&gt; Headings -&gt; Heading 1&quot; - the text will 
  become the title of your blog post.</p> 

	<?php 
function getTextBetweenTags($string, $tagname)
{
    $pattern = "/<{$tagname} ?.*>(.*)<\\/{$tagname}>/";
    preg_match($pattern, $string, $matches);
    return $matches[1];
}
$title = '';
if (isset($_POST["entry"])) {
    $title = str_replace(" ", "_", '.' . getTextBetweenTags($_POST["entry"], "h1"));
    //echo $title;
}
if (!empty($_POST["btnVal"])) {
    if ($_POST["btnVal"] == "New") {
        if (file_exists(date("dmY") . "{$title}.blog")) {
            unlink(date("dmY") . "{$title}.blog");
        } else {
            $logFile = fopen("../log", "a");
            fwrite($logFile, "Error deleting old blog." . "\n");
            fclose($logFile);
        }
    }
    if ($_POST["btnVal"] == "Save" && !empty($_POST["entry"])) {
        $toWrite = $_POST["entry"];
        $file = fopen(date("dmY") . "{$title}.blog", "w+");
Example #11
0
}
$format = isset($_REQUEST['format']) && !empty($_REQUEST['format']) ? $_REQUEST['format'] : 'xml';
$url = @trim($_REQUEST['url']);
if (empty($url)) {
    die('');
}
$ns = array('rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#', 'foaf' => 'http://xmlns.com/foaf/0.1/', 'dc' => 'http://purl.org/dc/elements/1.1/', 'dcterms' => 'http://purl.org/dc/terms/', 'scalar' => 'http://vectorsjournal.org/scalar/elements/1.0/', 'ctag' => 'http://commontag.org/ns#', 'art' => 'http://simile.mit.edu/2003/10/ontologies/artstor#', 'sioc' => 'http://rdfs.org/sioc/ns#', 'sioctypes' => 'http://rdfs.org/sioc/types#', 'foaf' => 'http://xmlns.com/foaf/0.1/', 'owl' => 'http://www.w3.org/2002/07/owl#');
$conf = array('ns' => $ns);
$resource = ARC2::getResource($conf);
$resource->setURI($url);
$resource->setProp('rdf:type', array('value' => 'scalar:External', 'type' => 'uri'));
$resource->setProp('dcterms:title', '');
$resource->setProp('dcterms:description', '');
$contents = @file_get_contents($url);
if ($contents) {
    $title = getTextBetweenTags($contents, 'title');
    if (empty($title)) {
        $title = '';
    }
    $resource->setProp('dcterms:title', trim($title));
    $meta = get_meta_data($contents);
    if (!empty($meta)) {
        $desc = '';
        foreach ($meta as $row) {
            if (empty($row[1])) {
                continue;
            }
            if ($row[1][0] == 'name' && $row[2][0] == 'description') {
                $desc = $row[3][0];
            }
        }
Example #12
0
<!DOCTYPE html>

<?php 
$id = htmlspecialchars($_GET["v"]);
if ($id == "") {
    header("Location: ../");
}
$contents = file_get_contents('https://www.youtube.com/watch?v=' . $id);
if (preg_match_all("/^.*" . preg_quote('<link itemprop="url" href="http://www.youtube.com/user/', '/') . ".*\$/m", $contents, $matches)) {
    $user = str_replace("          ", "", implode("\n", str_replace('">', "", str_replace('<link itemprop="url" href="http://www.youtube.com/user/', "", $matches[0]))));
}
if (preg_match_all("/^.*" . preg_quote('<title>', '/') . ".*\$/m", $contents, $matches)) {
    $title = getTextBetweenTags(str_replace(" - YouTube", "", explode("<link ", $matches[0][0])[0]), "title");
}
?>

<html itemtype="http://schema.org/WebPage">

    <!--                  _____ 
       _ __ _ _ __  _   _|  ___|__  _ __ _   _ _ __ ___    ___  _ __ __ _ _   
      (_) _` | '_ \| | | | |_ / _ \| '__| | | | '_ ` _ \  / _ \| '__/ _` (_)  
     _ | (_| | | | | |_| |  _| (_) | |  | |_| | | | | | || (_) | | | (_| |_ _ 
    (_|_)__,_|_| |_|\__, |_|  \___/|_|   \__,_|_| |_| |_(_)___/|_|  \__, (_|_)
                    |___/                                           |___/                                            
    
    Copyright Disclaimer Under Section 107 of the Copyright Act 1976, allowance 
    is made for fair use for purposes such as criticism, comment, news reporting, 
    teaching, scholarship, research, commentary, and or parody. Fair use is a use 
    permitted by copyright statute that might otherwise be infringing. Non-profit,
    educational or personal use tips the balance in favor of fair use. 
    -->
Example #13
0
function getTitle($page)
{
    if (preg_match_all("/^.*" . preg_quote('<title>', '/') . ".*\$/m", $page, $matches)) {
        return getTextBetweenTags(str_replace(" - YouTube", "", explode("<link ", $matches[0][0])[0]), "title");
    }
}
Example #14
0
             $messages['fields'][] = $error_type = "datepicker";
         }
     }
 } else {
     $vbulletin->GPC['birthdate'] = '';
 }
 $userdata_save =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY);
 // set profile fields
 $customfields = $userdata_save->set_userfields($vbulletin->GPC['userfield'], true, 'register');
 // pre save fields
 $userdata_save->pre_save();
 // check for errors
 if (!empty($userdata_save->errors)) {
     $valid_entries = FALSE;
     foreach ($userdata_save->errors as $index => $error) {
         $name = getTextBetweenTags($error, "em");
         if (!empty($name)) {
             $field = "userfield[{$name}]";
             $messages['fields'][] = $field;
             $messages['errors'][] = $error;
         }
     }
 } else {
     //$valid_entries = TRUE;
     unset($userdata_save->errors);
 }
 if ($valid_entries) {
     $fbID = $_SESSION['site_registration']["fbID"];
     if (isset($vbulletin->GPC['birthdate'])) {
         $birthday = preg_replace("/\\//", "-", $vbulletin->db->escape_string($vbulletin->GPC['birthdate']));
     }
Example #15
0
 function getEnumerated($question)
 {
     $enumeratedTemplate = $this->getTemplate()->getTemplateContent();
     $textwithoutrepeats = getTextBetweenTags($enumeratedTemplate, 'repeat');
     //expecting repeat!!
     $getEnumerated = $textwithoutrepeats[1];
     $getEnumerated .= $this->replaceEnumerated($question, $textwithoutrepeats[2]);
     $getEnumerated .= $this->getDKRFReplacements($question, $textwithoutrepeats[3]);
     return $getEnumerated;
 }
Example #16
0
function XSLOVZ_addipv6($params)
{
    $ctid = intval($params["serviceid"]);
    $sudo = $params["configoption7"];
    $vzctl = $params["configoption8"];
    # Additional variables if the product/service is linked to a server
    $server = $params["server"];
    # True if linked to a server
    $serverip = $params["serverip"];
    $serverusername = $params["serverusername"];
    $serverpassword = $params["serverpassword"];
    $connection = ssh2_connect("{$serverip}", XSLOVZ_getSSHPort('port', $params));
    ssh2_auth_password($connection, "{$serverusername}", "{$serverpassword}");
    // Get text from html tags
    function getTextBetweenTags($string, $tagname)
    {
        $pattern = "/\\{{$tagname} ?.*}(.*){\\/{$tagname}}/s";
        preg_match($pattern, $string, $matches);
        return $matches[1];
    }
    // get IPs and assign it to existing VPS
    $getctdetails = select_query("tblhosting", "", array("id" => $params['serviceid']));
    $ctdetails = mysql_fetch_assoc($getctdetails);
    $serverid = $ctdetails["server"];
    $server = select_query("tblservers", "", array("id" => $serverid));
    $server = mysql_fetch_assoc($server);
    $server_assigned_ips = getTextBetweenTags($server["assignedips"], "ipv6");
    if (!empty($server_assigned_ips)) {
        $server_assigned_ips = preg_split('/\\n|\\r/', $server_assigned_ips, -1, PREG_SPLIT_NO_EMPTY);
        foreach ($server_assigned_ips as $server_assigned_ip) {
            $assignedip = ssh2_exec($connection, "{$sudo} /usr/sbin/vzlist -a -o ip -H|grep -o -w {$server_assigned_ip}");
            stream_set_blocking($assignedip, true);
            $assignedip = trim(stream_get_contents($assignedip));
            $ip = trim($server_assigned_ip);
            $ctassignedips = $ctdetails['assignedips'];
            if ($assignedip != $ip) {
                $addip = ssh2_exec($connection, "{$sudo} {$vzctl} set {$ctid} --ipadd {$ip} --save");
                if ($addip) {
                    $ctassignedips .= "\n{$ip}\n";
                    update_query("tblhosting", array("assignedips" => $ctassignedips), array("id" => $params['serviceid']));
                    XSLOVZ_UnlimitTraffic($params);
                    XSLOVZ_LimitTraffic($params);
                }
                break;
            }
        }
    }
    if ($addip) {
        $result = "success";
    } else {
        $result = "Can't add IP";
    }
    return $result;
}
Example #17
0
    ?>

	<a href="<?php 
    bloginfo("url");
    ?>
/blog/" class="active">All</a>

<?php 
}
?>

<?php 
$args = array('type' => 'post', 'style' => '', 'title_li' => '', 'hide_empty' => 1, 'echo' => 0);
$categories = wp_list_categories($args);
$categories_array = explode("<br />", $categories);
$categories_labels = getTextBetweenTags('a', $categories);
?>

<?php 
for ($i = 0; $i < count($categories_array) - 1; $i++) {
    ?>

	<?php 
    if ($categories_labels[$i] == single_cat_title('', false)) {
        ?>

		<span class="active">

			<?php 
        echo $categories_array[$i];
        ?>
Example #18
0
         }
     }
 } else {
     $encodedSearch = urlencode($dataToSearch);
     $site = "http://www.jeuxdemots.org/rezo-xml.php?gotermsubmit=Chercher&gotermrel=" . $encodedSearch . "&output=onlyxml";
     $data = file_get_contents($site);
     if (strstr($data, '<def>') != NULL) {
         $monfichier = fopen("caches/" . $fileToSearch, 'w+');
         fputs($monfichier, $data);
     }
     $currentColonne = 0;
     $ligne = 0;
     $currentLigne = 0;
     if (strstr($data, 'OVERLOAD') == NULL) {
         $i = 0;
         $matches = getTextBetweenTags($data, "def");
         if ($matches != null) {
             echo "<div id = 'title'><h1><b>" . $dataToSearchWithFirstUpperCase . "</b></h1></div>";
             if ($matches != "") {
                 echo "<div id = 'titleDef' onclick = 'displayDefinition()'><h1><b><font color = 'midnightblue'> Definitions</font></b></h1></div><div id = 'definition'>" . $matches . "<br><br></div>";
             }
             preg_match("#<sortant>(.*)</sortant>#Us", $data, $matches2);
             if ($matches2 != null) {
                 echo "<div id = 'titleSortantes' onclick = 'displaySortantes()'><h1><b><font color = 'red'> Relations sortantes</font></b></h1></div>";
                 echo "<div id = 'relationsSortantes'><br>";
                 $rel = explode(">", $matches2[1]);
                 $arrayTypesRel = array();
                 for ($i; $i < sizeof($rel); $i++) {
                     $typesRel = explode("type=\"", $rel[$i]);
                     $j = 0;
                     for ($j; $j < sizeof($typesRel); $j++) {
function constructRequest($phoneNumber)
{
    $baseURL = "www.truecaller.com/in/";
    $finalURL = $baseURL . $phoneNumber;
    return 'http://' . $finalURL;
}
function sendRequest($phoneNumber)
{
    $requestURL = constructRequest($phoneNumber);
    $curl = curl_init();
    $setUserAgent = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36";
    $setCookie = "YOUR FACEBOOK COOKIE";
    curl_setopt($curl, CURLOPT_URL, $requestURL);
    curl_setopt($curl, CURLOPT_USERAGENT, $setUserAgent);
    curl_setopt($curl, CURLOPT_COOKIE, $setCookie);
    $result = curl_exec($curl) or die(curl_error($curl));
    curl_close($curl);
    return $result;
}
function getTextBetweenTags($string, $tagname)
{
    // Create DOM from string
    $html = str_get_html($string);
    $titles = array();
    // Find all tags
    foreach ($html->find($tagname) as $element) {
        $titles[] = $element->plaintext;
    }
}
getTextBetweenTags(sendRequest('9772536250'), 'h1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $_SERVER['REQUEST_URI']);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo);
curl_setopt($ch, CURLOPT_URL, "http://internship.iitm.ac.in/students/comp_list.php");
$html = curl_exec($ch);
curl_close($ch);
function getTextBetweenTags($string, $tag1, $tag2)
{
    $pattern = "/<{$tag1}?.*><{$tag2}?.*>(.*)<\\/{$tag2}><\\/{$tag1}>/";
    preg_match_all($pattern, $string, $matches);
    return $matches[1];
}
$txt1 = getTextBetweenTags($html, "strong", "font");
$txt2 = getTextBetweenTags($html, "a", "font");
$len = count($txt1);
$txt = array();
$init = "";
for ($i = 0; $i < $len; $i++) {
    $txt0["name"] = $txt1[$i];
    $txt0["profile"] = $txt2[$i];
    $txt["companies"][] = $txt0;
}
$txt["count"] = $len;
echo json_encode($txt["count"]);
?>