本文整理汇总了PHP中get_url_content函数的典型用法代码示例。如果您正苦于以下问题:PHP get_url_content函数的具体用法?PHP get_url_content怎么用?PHP get_url_content使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_url_content函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_current_picture_profile
function get_current_picture_profile($username)
{
$picture = str_get_html(get_url_content('https://twitter.com/' . $username))->find('img.ProfileAvatar-image');
if (isset($picture[0]->attr['src'])) {
return $picture[0]->attr['src'];
} else {
return 'http://a0.twimg.com/sticky/default_profile_images/default_profile_5_200x200.png';
}
}
示例2: cron_get_page_details_from_fb
function cron_get_page_details_from_fb($ids)
{
$datos = get_url_content('https://graph.facebook.com/fql?q=SELECT+page_id,username,name,about,description,pic_small,pic_cover,is_verified+FROM+page+WHERE+page_id+IN(' . $ids . ')');
$datosarray = json_decode($datos, true);
if (isset($datosarray['data']) && count($datosarray['data']) > 0) {
return $datosarray['data'];
}
return NULL;
}
示例3: generate_data_results
function generate_data_results($page_id)
{
error_log(' Generate Page (i): ' . date('d m Y H:i:s'));
$json_data_page = get_url_content('http://www.owloo.com/wservice/table_results/facebook_pages.php?generate_new_page=true&generate_new_page_id=' . $page_id);
error_log(' Generate Page (f): ' . date('d m Y H:i:s'));
echo $json_data_page;
error_log(' Generate Results (f): ' . date('d m Y H:i:s'));
die;
}
示例4: cron_get_likes_talking_about_from_fb
function cron_get_likes_talking_about_from_fb($ids)
{
/*$datos = file_get_contents('https://graph.facebook.com/fql?q=SELECT+page_id,fan_count,talking_about_count+FROM+page+WHERE+page_id+IN('.$ids.')');*/
$datos = get_url_content('http://23.88.103.193/~david/owl/gat_fb_data_like.php?ids=' . $ids);
$datosarray = json_decode($datos, true);
if (isset($datosarray['data']) && count($datosarray['data']) > 0) {
return $datosarray['data'];
}
return NULL;
}
示例5: get_veoh
function get_veoh($url)
{
// get the music_id
$ari = explode("/", $url);
$v_id = array_pop($ari);
// retrieve xml files
$data = get_url_content("http://www.veoh.com/rest/video/" . $v_id . "/details");
// retrieve path into music files
$hasil = get_inbetween("fullPreviewHashPath", "fullPreviewToken=", $data);
$hasil = str_replace(array('"', '='), "", $hasil);
// yell it loud
return trim($hasil);
}
示例6: get_current_picture_profile
function get_current_picture_profile($username)
{
$html = get_url_content('http://instagram.com/' . $username);
$doc = new DOMDocument();
$doc->loadHTML($html);
foreach ($doc->getElementsByTagName('meta') as $meta) {
if ($meta->getAttribute('property') == 'og:image') {
if ($meta->getAttribute('content') != '') {
return $meta->getAttribute('content');
}
}
}
return 'http://a0.twimg.com/sticky/default_profile_images/default_profile_5_200x200.png';
}
示例7: getNumAudience
function getNumAudience($code, $key_language, $_accessToken, $_accountId, $_pageId, $_pageName)
{
$numAudience = "";
try {
$datos = get_url_content('https://graph.facebook.com/act_' . $_accountId . '/reachestimate?access_token=' . $_accessToken . '&accountId=' . $_accountId . '&bid_for=["conversion"]¤cy=USD&endpoint=/act_' . $_accountId . '/reachestimate&locale=es_LA&method=get&pretty=0&targeting_spec={"genders":[],"age_max":65,"age_min":13,"regions":[],"countries":[],"cities":[],"zips":[],"keywords":[],"connections":[],"friends_of_connections":[],"relationship_statuses":null,"interested_in":[],"college_years":[],"education_statuses":[],"locales":[' . $key_language . '],"user_adclusters":[],"user_os":[],"user_device":[],"wireless_carrier":[],"work_positions":[],"education_majors":[],"education_schools":[],"work_employers":[],"page_types":null,"geo_locations":{"countries":["' . $code . '"],"cities":[],"regions":[],"zips":[]},"excluded_geo_locations":{"countries":[],"cities":[],"regions":[],"zips":[]}}');
$datosarray2 = json_decode($datos, true);
//print_r($datosarray2 ); die();
$numAudience = $datosarray2['users'];
if ($numAudience != "" && is_numeric($numAudience)) {
return $numAudience;
}
} catch (Exception $e) {
return false;
}
return false;
}
示例8: instagram_user_posts
function instagram_user_posts($user_id, $max_id = NULL, $min_id = NULL, $pagination = NULL)
{
$limit = '';
if (!empty($max_id)) {
$limit = '&max_id=' . $max_id;
}
if (!empty($min_id)) {
$limit = '&min_id=' . $min_id;
}
if (empty($pagination)) {
$data = get_url_content("https://api.instagram.com/v1/users/{$user_id}/media/recent/?client_id=" . INSTAGRAM_CLIENT_ID . "&count=" . INSTAGRAM_COUNT_DATA . $limit);
} else {
$data = get_url_content($pagination);
}
return json_decode($data, true);
}
示例9: handle_row
function handle_row($row, $conn)
{
global $row_tmp;
$url = $row['url'];
$content = get_url_content($url);
if ($content == null) {
return;
} else {
$row_tmp[$url] = array();
// 更新最後檢查的時間,先存入暫時的陣列
date_default_timezone_set('Asia/Taipei');
$row_tmp[$url]['last_check'] = date('Y/m/d l H:i:s', time());
// 日期減一,先存入暫時的陣列
$row_tmp[$url]['remaining'] = $row['remaining'] - 1;
// 檢查推文數量是否有變化,先存入暫時的陣列
$row_tmp[$url]['push_count'] = substr_count($content, "push-content");
// 偵測到這篇文章有新增推文的話,就設定信件內容,等等再寄出
if ($row_tmp[$url]['push_count'] != $row['push_count']) {
set_message($row);
}
}
}
示例10: getNumAudience
function getNumAudience($code, $age_min, $age_max, $gender, $_accessToken, $_accountId, $_pageId, $_pageName)
{
$numAudience = "";
try {
$datos = get_url_content('https://graph.facebook.com/act_' . $_accountId . '/reachestimate?access_token=' . $_accessToken . '&accountId=' . $_accountId . '&bid_for=["conversion"]¤cy=USD&endpoint=/act_' . $_accountId . '/reachestimate&locale=es_LA&method=get&pretty=0&targeting_spec={"genders":[' . $gender . '],"age_max":' . $age_max . ',"age_min":' . $age_min . ',"regions":[],"countries":[],"cities":[],"zips":[],"keywords":[],"connections":[],"friends_of_connections":[],"relationship_statuses":null,"interested_in":[],"college_years":[],"education_statuses":[],"locales":[],"user_adclusters":[],"user_os":[],"user_device":[],"wireless_carrier":[],"work_positions":[],"education_majors":[],"education_schools":[],"work_employers":[],"page_types":null,"geo_locations":{"countries":["' . $code . '"],"cities":[],"regions":[],"zips":[]},"excluded_geo_locations":{"countries":[],"cities":[],"regions":[],"zips":[]}}');
$datosarray2 = json_decode($datos, true);
//print_r($datosarray2 ); die();
if (isset($datosarray2['users'])) {
$numAudience = $datosarray2['users'];
if ($numAudience != "" && is_numeric($numAudience)) {
return $numAudience;
}
} else {
if (isset($datosarray2['error'])) {
if ($datosarray2['error']['code'] != 190) {
send_email('country_3_1', 'Owloo ERROR - Pais AGE 3.1', 'ERROR en la captura de datos.', true, 'Facebook error code - Pais - ID = ' . $_SERVER['argv'][1] . ' - Code: ' . $datosarray2['error']['code'] . ' - Mensaje: ' . $datosarray2['error']['message']);
}
}
}
} catch (Exception $e) {
return false;
}
return false;
}
示例11: insert_url_temp
function insert_url_temp($site_id, $url, $level)
{
global $db;
$url_htmlcode = get_url_content($url);
$url_htmlcode = get_encoding($url_htmlcode, "GB2312");
$links = get_links($url_htmlcode, $url, 1, $url);
//echo $url;
// print_r ($links);
foreach ($links as $key => $value) {
$array = array('no_id' => $key, 'site_id' => $site_id, 'updatetime' => $level, 'url' => $value);
$query = $db->query("select * from ve123_links_temp where url='" . $value . "'");
$num = $db->num_rows($query);
if ($num == 0) {
$db->insert("ve123_links_temp", $array);
} else {
$db->update("ve123_links_temp", $array, "url='" . $value . "'");
}
}
}
示例12: add_links
function add_links($url, $is_index_page = true, $num = '')
{
global $db;
$new_links = array();
$j = 1;
$url_htmlcode = get_url_content($url);
$url_htmlcode = get_encoding($url_htmlcode, "GB2312");
$links = get_links($url_htmlcode, $url, 1, $url);
if ($is_index_page) {
foreach ($links as $value) {
$new_links[] = GetSiteUrl($value);
}
} else {
$new_links = $links;
}
$new_links = distinct_array($new_links);
foreach ($new_links as $value) {
echo $value . "<br>";
flush();
$query = $db->query("select * from ve123_links where url='{$value}'");
$num = $db->num_rows($query);
if ($num == 0) {
if (!add_update_link($value, "", "", "add")) {
continue;
}
$j++;
if (!empty($num)) {
if ($j >= $num) {
exit;
}
}
}
}
}
示例13: get_fb_page_id_from_url
function get_fb_page_id_from_url($url)
{
if (strpos($url, 'facebook.com/') === false) {
} else {
$url = add_https_to_url($url);
}
$datos = get_url_content('https://graph.facebook.com/' . $url);
//$datos = @file_get_contents('http://23.88.103.193/~david/owl/get_fb_data.php?url='.urlencode('https://graph.facebook.com/'.$url));
$datos = json_decode($datos, true);
if (isset($datos['id'])) {
return $datos['id'];
}
return NULL;
}
示例14: rebuild_search_indexes
function rebuild_search_indexes()
{
global $success_msg;
global $error_msg;
global $warning_msg;
global $all_settings;
global $indexable_folders;
$index_folder = get_setting('search_indexes_folder', $all_settings);
try {
setlocale(LC_CTYPE, LOCALE);
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive());
$index = new Zend_Search_Lucene($index_folder, true);
$files_to_index = get_website_files($indexable_folders);
foreach ($files_to_index as $html_file => $page_url) {
if (can_index_website_file($html_file)) {
$f1 = strtolower($html_file);
if (end_with($f1, 'html') || end_with($f1, 'htm')) {
$file_content = file_get_contents($html_file);
} elseif (end_with($f1, 'php')) {
if (is_http_code_200($page_url)) {
$file_content = get_url_content($page_url);
}
}
if (isset($file_content)) {
$file_content = '<html>' . strstr($file_content, '<head');
$doc = Zend_Search_Lucene_Document_Html::loadHTML($file_content, true, 'UTF-8');
$doc->addField(Zend_Search_Lucene_Field::Text('url', $page_url, 'UTF-8'));
$index->addDocument($doc);
flush();
}
}
}
$broken_urls = array();
foreach (get_dynamic_urls(get_setting('search_dynamic_pages', $all_settings)) as $url) {
if (is_http_code_200($url)) {
$content = get_url_content($url);
$content = '<html>' . strstr($content, '<head');
$doc = Zend_Search_Lucene_Document_Html::loadHTML($content, true, 'UTF-8');
$doc->addField(Zend_Search_Lucene_Field::Text('url', $url, 'UTF-8'));
$index->addDocument($doc);
flush();
} else {
array_push($broken_urls, $url);
}
}
if (file_exists($index_folder)) {
if (count($broken_urls) > 0) {
$warning_msg = '<p>The website was successfully indexed, but the following URL\'s were skipped because they are broken:</p>';
$warning_msg .= '<ul class="disc">';
foreach ($broken_urls as $broken_url) {
$warning_msg .= '<li><a href="' . $broken_url . '">' . $broken_url . '</a></li>';
}
$warning_msg .= '</ul>';
$warning_msg .= '<p>Please remove them from the "List of dynamic pages" field.</p>';
} else {
$success_msg = 'The website was successfully indexed.';
}
} else {
$error_msg = 'An error occurred during the website indexing. The error message is: the folder that stores the website indexes couldn\'t be created';
}
} catch (Exception $e) {
$error_msg = 'An error occurred during the website indexing. The error message is: ' . $e->getMessage();
}
}
示例15: get_url_content
<?php
die;
require_once '../config.php';
//UPDATE `facebook_country_3_1` c SET id_continent = (SELECT id_continent FROM country WHERE code = c.code) WHERE code in (SELECT code FROM country)
$datos = get_url_content('https://graph.facebook.com/search?q=&type=adcountry&limit=1000');
$datosarray = json_decode($datos, true);
//print_r($datosarray);
foreach ($datosarray['data'] as $data) {
$sql = "INSERT INTO facebook_country_3_1 VALUES(null, '\$1', '', '\$2', '', '', 0, 0, " . ($data['supports_region'] == 'true' ? 1 : 0) . ", " . ($data['supports_city'] == 'true' ? 1 : 0) . ", 1, 1);";
$res = db_query($sql, array($data['country_code'], $data['name']), true);
}
$datos = get_url_content('https://graph.facebook.com/search?q=&type=adcountry&limit=1000&locale=es_LA');
$datosarray = json_decode($datos, true);
foreach ($datosarray['data'] as $data) {
$sql = "UPDATE facebook_country_3_1 SET nombre = '\$1' WHERE code like '\$2';";
$res = db_query($sql, array($data['name'], $data['country_code']), true);
}
echo 'FIN';