Example #1
0
function getTagsInfoByUrl($url)
{
    //Load url
    $html = file_get_html($url);
    $classCount = substr_count($html, 'class="tag tag-');
    if ($classCount == 0) {
        return getGalleryInfo($url);
    }
    if ($html == '') {
        $dieObj = array("error" => "404 Not Found");
        echo json_encode($dieObj);
        die;
    }
    $tempHtml = $html->find('div[id=tag-container]', 0);
    //echo $tempHtml;
    $output = array();
    $iii = 0;
    while ($iii < $classCount) {
        $tempHtmlItem = $tempHtml->find('a[class=tag]', $iii);
        $tagUrl = getbetween($tempHtmlItem, '<a href="/', '/"');
        $tagFather = getbetween($tempHtmlItem, '<a href="/', '/');
        $tagSon = getbetween($tagUrl, '/', '/"');
        //echo $tagUrl . '<br>';
        $tempItem = array('tagUrl' => urlencode('http://nhentai.net/' . $tagUrl), 'tagFather' => $tagFather, 'tagSon' => $tagSon);
        array_push($output, $tempItem);
        $iii++;
    }
    return $output;
}
Example #2
0
function getbetween($str, $start, $end)
{
    $z = explode($start, $str);
    if (count($z) == 1) {
        return "";
    }
    unset($z[0]);
    $d = explode($end, implode($start, $z));
    $str = $d[0];
    unset($d[0]);
    $str .= getbetween(implode($end, $d), $start, $end);
    return $str;
}