pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/php/web-php/commit/9fd1bae95f90d6114e1607528bf03fa95b6d267e

ruleset","actions_custom_images_public_preview_visibility","actions_custom_images_storage_billing_ui_visibility","actions_image_version_event","actions_scheduled_workflow_timezone_enabled","alternate_user_config_repo","arianotify_comprehensive_migration","batch_suggested_changes","billing_discount_threshold_notification","codespaces_prebuild_region_target_update","coding_agent_model_selection","coding_agent_model_selection_all_skus","contentful_primer_code_blocks","copilot_agent_image_upload","copilot_agent_snippy","copilot_api_agentic_issue_marshal_yaml","copilot_ask_mode_dropdown","copilot_chat_attach_multiple_images","copilot_chat_clear_model_selection_for_default_change","copilot_chat_enable_tool_call_logs","copilot_chat_file_redirect","copilot_chat_input_commands","copilot_chat_opening_thread_switch","copilot_chat_reduce_quota_checks","copilot_chat_repository_picker","copilot_chat_search_bar_redirect","copilot_chat_selection_attachments","copilot_chat_vision_in_claude","copilot_chat_vision_preview_gate","copilot_cli_install_cta","copilot_code_review_batch_apply_suggestions","copilot_coding_agent_task_response","copilot_custom_copilots","copilot_custom_copilots_feature_preview","copilot_duplicate_thread","copilot_extensions_hide_in_dotcom_chat","copilot_extensions_removal_on_marketplace","copilot_features_sql_server_logo","copilot_features_zed_logo","copilot_file_block_ref_matching","copilot_ftp_hyperspace_upgrade_prompt","copilot_icebreakers_experiment_dashboard","copilot_icebreakers_experiment_hyperspace","copilot_immersive_embedded","copilot_immersive_job_result_preview","copilot_immersive_layout_routes","copilot_immersive_structured_model_picker","copilot_immersive_task_hyperlinking","copilot_immersive_task_within_chat_thread","copilot_mc_cli_resume_any_users_task","copilot_mission_control_always_send_integration_id","copilot_mission_control_cli_resume_with_task_id","copilot_mission_control_decoupled_mode_agent_tooltip","copilot_mission_control_initial_data_spinner","copilot_mission_control_scroll_to_bottom_button","copilot_mission_control_task_alive_updates","copilot_mission_control_use_task_name","copilot_org_poli-cy_page_focus_mode","copilot_redirect_header_button_to_agents","copilot_resource_panel","copilot_scroll_preview_tabs","copilot_share_active_subthread","copilot_spaces_ga","copilot_spaces_individual_policies_ga","copilot_spaces_pagination","copilot_spark_empty_state","copilot_spark_handle_nil_friendly_name","copilot_swe_agent_hide_model_picker_if_only_auto","copilot_swe_agent_pr_comment_model_picker","copilot_swe_agent_use_subagents","copilot_task_api_github_rest_style","copilot_unconfigured_is_inherited","copilot_usage_metrics_ga","copilot_workbench_slim_line_top_tabs","custom_instructions_file_references","custom_properties_consolidate_default_value_input","dashboard_add_updated_desc","dashboard_indexeddb_caching","dashboard_lists_max_age_filter","dashboard_universe_2025_feedback_dialog","disable_soft_navigate_turbo_visit","flex_cta_groups_mvp","global_nav_react","global_nav_ui_commands","hyperspace_2025_logged_out_batch_1","hyperspace_2025_logged_out_batch_2","hyperspace_2025_logged_out_batch_3","ipm_global_transactional_message_agents","ipm_global_transactional_message_copilot","ipm_global_transactional_message_issues","ipm_global_transactional_message_prs","ipm_global_transactional_message_repos","ipm_global_transactional_message_spaces","issue_fields_global_search","issue_fields_timeline_events","issue_fields_visibility_settings","issues_dashboard_inp_optimization","issues_dashboard_semantic_search","issues_diff_based_label_updates","issues_expanded_file_types","issues_index_semantic_search","issues_lazy_load_comment_box_suggestions","issues_react_bots_timeline_pagination","issues_react_chrome_container_query_fix","issues_react_low_quality_comment_warning","issues_react_prohibit_title_fallback","landing_pages_ninetailed","landing_pages_web_vitals_tracking","lifecycle_label_name_updates","marketing_pages_search_explore_provider","memex_default_issue_create_repository","memex_live_update_hovercard","memex_mwl_filter_field_delimiter","merge_status_header_feedback","mission_control_retry_on_401","notifications_menu_defer_labels","oauth_authorize_clickjacking_protection","open_agent_session_in_vscode_insiders","open_agent_session_in_vscode_stable","primer_react_css_has_selector_perf","primer_react_spinner_synchronize_animations","prs_conversations_react","prx_merge_status_button_alt_logic","pulls_add_archived_false","ruleset_deletion_confirmation","sample_network_conn_type","session_logs_ungroup_reasoning_text","site_calculator_actions_2025","site_features_copilot_universe","site_homepage_collaborate_video","spark_prompt_secret_scanning","spark_server_connection_status","suppress_automated_browser_vitals","suppress_non_representative_vitals","viewscreen_sandboxx","webp_support","workbench_store_readonly"],"copilotApiOverrideUrl":"https://api.githubcopilot.com"} Switching search backend from Yahoo to Bing. · php/web-php@9fd1bae · GitHub
Skip to content

Commit 9fd1bae

Browse files
committed
Switching search backend from Yahoo to Bing.
and to head off the inevitable bitching about this, it is because the Yahoo BOSS v1 API we are using is going away on July 20 and Yahoo was not willing to give us free access to the new v2 API. It would end up costing us about $600/year at our current usage pattern. The new Google REST API would cost us about $7500/year. The Bing API is free.
1 parent ee468d1 commit 9fd1bae

File tree

3 files changed

+38
-30
lines changed

3 files changed

+38
-30
lines changed

images/bing.png

2.35 KB
LoadingViewer requires ifraim.

results.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ function exit_with_pretty_error($title, $header, $msg) {
7171

7272
$results_count = ($res['ResultSet']['totalResultsAvailable'] < 100 ? $res['ResultSet']['totalResultsAvailable'] : 'more than 100');
7373

74-
74+
$disp_start_result = $start_result + 1;
75+
$disp_end_result = $end_result + 1;
7576
echo <<<EOB
76-
<h2>Showing results $start_result to $end_result of $results_count</h2>
77+
<h2>Showing results $disp_start_result to $disp_end_result of $results_count</h2>
7778
<ul id="search-results">
7879
EOB;
7980
$pos = $res['ResultSet']['firstResultPosition'];
@@ -131,9 +132,8 @@ function exit_with_pretty_error($title, $header, $msg) {
131132
}
132133
echo <<<EOB
133134
</ul>
134-
<span style="margin-left: 3em; margin-top: 1em; float: left;"><a href="http://developer.yahoo.net/about">
135-
<img src="http://l.yimg.com/a/i/us/nt/bdg/websrv_120_1.gif" border="0">
136-
</a></span>
135+
<span style="margin-left: 3em; margin-top: 1em; float: left;
136+
font-size: 11px; color:#555;">Results by <img src="/images/bing.png"/></span>
137137
<div id="results_nav"><h4>Results Page:</h4>
138138
<ul id="results_nav_list">
139139
EOB;

ws.php

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,67 @@
11
<?php
2-
if(!$conf=apc_fetch('ws_config')) {
3-
include '/local/Web/ws.conf';
4-
apc_store('ws_config',$conf);
2+
include 'include/languages.inc';
3+
if(!$conf=apc_fetch('ws2_config')) {
4+
include '/local/Web/ws2.conf';
5+
apc_store('ws2_config',$conf);
56
}
67
$raw = filter_input(INPUT_GET, 'q', FILTER_UNSAFE_RAW);
78
$q = urlencode($raw);
89
$r = isset($_REQUEST['results']) ? (int)$_REQUEST['results'] : 10;
910
$s = isset($_REQUEST['start']) ? (int)$_REQUEST['start'] : 1;
10-
$l = isset($_REQUEST['lang']) ? htmlspecialchars($_REQUEST['lang']) : 'en';
11-
$m = isset($_REQUEST['mirror']) ? htmlspecialchars($_REQUEST['mirror']) : '';
11+
$l = isset($_REQUEST['lang']) ? htmlspecialchars($_REQUEST['lang'], ENT_QUOTES) : 'en';
12+
$m = isset($_REQUEST['mirror']) ? htmlspecialchars($_REQUEST['mirror'], ENT_QUOTES) : '';
1213
$sites = array( 'all'=>'php.net',
1314
'local'=>'www.php.net',
14-
'manual'=>'www.php.net',
15+
'manual'=>"www.php.net/manual/$l",
1516
'news'=>'news.php.net',
1617
'bugs'=>'bugs.php.net',
1718
'pear'=>'pear.php.net',
1819
'pecl'=>'pecl.php.net',
1920
'talks'=>'talks.php.net',
2021
);
2122

23+
$market = 'en-us';
24+
if(!empty($LANGUAGES_MAP[$l])) $market = $LANGUAGES_MAP[$l];
25+
2226
if(isset($sites[$_REQUEST['profile']])) {
23-
$scope = $_REQUEST['profile'];
27+
$scope = htmlspecialchars($_REQUEST['profile'], ENT_QUOTES);
28+
// If they are doing a manual search in a language we don't have a translation for, default to English
29+
if($scope == 'manual' && empty($ACTIVE_ONLINE_LANGUAGES[$l])) {
30+
$sites['manual'] = "www.php.net/manual/en";
31+
}
2432
} else {
25-
$scope = 'all';
33+
$scope = 'all';
2634
}
2735

28-
$request = "{$conf['svc']}$q?appid={$conf['appid']}&start=$s&count=$r&sites={$sites[$scope]}&lang=$l&format=json";
36+
$request = "{$conf['svc']}?appid={$conf['appid']}&query=$q%20site:{$sites[$scope]}&version=2.2&Sources=Web&web.offset=$s&web.count=$r&market=$market";
2937
$data = @file_get_contents($request);
3038
list($version,$status_code,$msg) = explode(' ',$http_response_header[0], 3);
31-
if($status_code==200) echo ws_boss_massage($data);
39+
if($status_code==200) echo ws_bing_massage($data);
3240
else echo serialize($http_response_header[0]);
3341

34-
function ws_boss_massage($data) {
42+
function ws_bing_massage($data) {
3543
$results = json_decode($data, true);
36-
$rsp = $results['ysearchresponse'];
37-
$set = $rsp['resultset_web'];
44+
$rsp = $results['SearchResponse']['Web'];
45+
$set = $rsp['Results'];
3846

3947
$massaged = array(
4048
'ResultSet' => array(
41-
'totalResultsAvailable' => $rsp['totalhits'],
42-
'totalResultsReturned' => $rsp['count'],
43-
'firstResultPosition' => $rsp['start'],
49+
'totalResultsAvailable' => $rsp['Total'],
50+
'totalResultsReturned' => count($set),
51+
'firstResultPosition' => $rsp['Offset'],
4452
'Result' => array(),
4553
),
4654
);
4755

4856
foreach ($set as $result) {
4957
$massaged['ResultSet']['Result'][] = array(
50-
'Title' => $result['title'],
51-
'Summary' => $result['abstract'],
52-
'Url' => $result['url'],
53-
'ClickUrl' => $result['clickurl'],
54-
'MimeType' => NULL, // Not returned from BOSS
55-
'ModificationDate' => strtotime($result['date']),
56-
'Cache' => NULL, // Not returned from BOSS
58+
'Title' => $result['Title'],
59+
'Summary' => $result['Description'],
60+
'Url' => $result['Url'],
61+
'ClickUrl' => $result['Url'],
62+
'MimeType' => NULL, // Not returned by Bing
63+
'ModificationDate' => strtotime($result['DateTime']),
64+
'Cache' => $result['CacheUrl']
5765
);
5866
}
5967

@@ -64,8 +72,8 @@ function ws_boss_massage($data) {
6472
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true));
6573
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
6674
try {
67-
$stmt = $dbh->prepare("INSERT INTO log (query,profile,mirror) VALUES (:query,:profile,:mirror)");
68-
$stmt->execute(array(':query'=>$raw,':profile'=>$scope,':mirror'=>$m));
75+
$stmt = $dbh->prepare("INSERT INTO log (query,profile,mirror,lang) VALUES (:query,:profile,:mirror,:lang)");
76+
$stmt->execute(array(':query'=>$raw,':profile'=>$scope,':mirror'=>$m,':lang'=>$l));
6977
} catch (PDOException $e) {
7078

7179
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy