$pos = strpos($pContent, "mage: ");
                    // Si buscamos Image: nos da 0 que es === false
                    if ($pos !== false) {
                        $userImage = $paragraph->find('a', 0)->title;
                        echo "\nImage: " . $userImage;
                    } else {
                        // Check if it is a link
                        $pos = strpos($pContent, "age: ");
                        // Si buscamos Image: nos da 0 que es === false
                        if ($pos !== false) {
                            $link = $paragraph->find('a', 0)->title;
                            echo "\nLink: " . $link;
                            $pages[] = $link;
                        }
                    }
                }
                $oneResult['website'] = $title;
                $oneResult['imageURL'] = $userImage;
                $oneResult['links'] = $pages;
                $results[] = $oneResult;
            }
        } else {
            // handle this situation
        }
    }
    //close connection
    curl_close($ch);
    return $results;
}
$toPrint = getInfoFromPicture("https://ksr-ugc.imgix.net/avatars/59676/bill_avatar_full_size.original.jpg?v=1425468393&w=40&h=40&fit=crop&auto=format&q=92&s=ddaafe3577ea638451801eb02af63592");
print_r($toPrint);
Пример #2
0
 // Create DOM from URL
 $html = file_get_html($prefix . $projectURL . '/comments');
 //print_r($html);
 //var_dump($html->find('.older_commentssafdsf'));
 $continue = false;
 $continueURL = "";
 $page = 0;
 do {
     echo $page++;
     // Find all article blocks
     foreach ($html->find('.comments .comment') as $comment) {
         $item['project'] = $projectName;
         $item['name'] = $comment->find('.author', 0)->innertext;
         $item['profile'] = str_replace("amp;", "", $prefix . $comment->find('.author', 0)->href);
         $item['picture'] = str_replace("amp;", "", $comment->find('img', 0)->src);
         $resultForPicture = getInfoFromPicture($item['picture']);
         if (!in_array($item, $comments)) {
             $comments[] = $item;
         }
     }
     $continueURL = $html->find('.older_comments', 0)->href;
     if (strcmp("", $continueURL) !== 0) {
         echo "\nOlder comments URL: " . $prefix . $continueURL . "\n\n";
         // Update the url to get
         $html = file_get_html($prefix . $continueURL);
         $continue = true;
     } else {
         echo "\nThere are no more comments";
         $continue = false;
     }
 } while ($continue);