הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

 
 
כלים לאשכול תצורת הצגה
Prev הודעה קודמת   הודעה הבאה Next
ישן 05-02-09, 22:58   # 6
Elad-A
הוסטסניון
 
מיני פרופיל
תאריך הצטרפות: May 2006
הודעות: 1,987

Elad-A לא מחובר  

יש פונקצייה שנכתבה ע"י The AcE :

PHP קוד:
function getLinks ($file) {
    
$ur=parse_url($file);            #parsh the URL
    
$data=file_get_contents($file);    #get the file from the server
    
$regex="/<a.*href=[\"']?([^\"' >]+)[\"' >](.*)<\/a>/imsU";
    
preg_match_all($regex,$data,$matches,PREG_SET_ORDE  R);
    
$_ins=array(); $_outs=array();
    
$_ins[]=trim($ur['path'],"/");
    foreach (
$matches as $match) {
        
$purl=parse_url($match[1]);
        if ((    
#check if it is an inner link
                
($purl['host']    == $ur['host'] and $purl['scheme'] == 'http')
            or    (!
$purl['host'] and !$purl['scheme']))        #check if has host (for when href is: 'javascript' then scheme is 'javascript' and no host set)
            
and    !in_array(trim($purl['path'],"/"),$_ins)    #check if not in our array, we don't need duplicated addresses
            
) {
            
$ins[]=array('text'=>$match[2],'href'=>trim($purl['path'],"/"));
            
$_ins[]=trim($purl['path'],"/");
            continue;
        } elseif (
                
$purl['host'] != $ur['host']    #check that it is actually an outgoing link
            
and    !in_array(ltrim($match[1],"/"),$_outs#check if not in our array to avoid duplicated links
            
and    $purl['scheme'] == "http"         #get only the http links
            
) {
            echo 
"Putting in outs.\n";
            
$outs[]=array('text'=>$match[2],'href'=>ltrim($match[1],"/"));
            
$_outs[]=ltrim($match[1],"/");
            continue;
        }
    }
    return array(
'outs'=>$outs,'ins'=>$ins);

הפונקצייה מחזירה פלט בצורה של קישורים נכנסים \ יוצאים מהדף, כמובן שכל הקרדיט הולך אליו כן?
  Reply With Quote
 

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 22:40.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ