2011-12-12 81 views
1

我正在編寫一些代碼,它將搜索網站並返回搜索結果的數量。有點像這樣Number of Google Results from Excel但我正在使用的網站是sciencedirect.com如何創建網站的搜索URL使用<select>

科學直接有點奇怪,因爲結果頁面的網址不包含搜索詞,所以找到發送您的搜索詞的URL是更復雜。我一直在讀高級搜索頁面的源代碼,這是代碼的相關部分:

<form name="Form1" method="get" action="/science"> 
    <input type="hidden" name="_ob" value="MiamiSearchURL"> 
    <input type="hidden" name="_method" value="submitForm"> 
    <input type="hidden" name="_acct" value="C000053194"> 



    <input type="hidden" name="_temp" value="all_search.tmpl"> 


    <input type="hidden" name="md5" value="9e299e9289462d7805ab0a5dcc9cff5c"> 
    <input type="hidden" name="test_alid" value=""> 

<div class="contentMain" style="margin:1px 0 0 1px;"><div class="contentShadow"><div class="contentBorders"> 

<div class="searchFormBg"> 
    <div style="text-align:right;"> 
    <a href="/science?_ob=HelpURL&_file=stadv_main_all.htm&_acct=C000053194&_version=1&_urlVersion=0&_userid=1495569&md5=77d715b68200140e79de4e6c4228507e" target="sdhelp" onClick="var helpWin; helpWin=window.open('/science?_ob=HelpURL&_file=stadv_main_all.htm&_modifyAlert=Y&_acct=C000053194&_version=1&_urlVersion=0&_userid=1495569&md5=5aa55cdf2635b42c8858e3379a022f8d','sdhelp','scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,status=no,width=760,height=570'); helpWin.focus()" class="noul icon_qmarkHelpsci_dir">Search tips</a> 

    </div> 
     <div>   
     <a name="Skip Search"></a><label class="searchFormLabel" for="SearchText">Search&nbsp;</label> 
     <input type="text" class="inputBox" name="SearchText" id="SearchText" value="" size="60" maxlength="256">&nbsp;&nbsp;in&nbsp;&nbsp; 
      <select name="keywordOpt" id="keywordOpt" size="1"> 
      <option value="ALL" selected >All Fields</option> 
      <option value="TITLE-ABSTR-KEY" >Abstract, Title, Keywords</option> 
      <option value="AUTHORS" >Authors</option> 
      <option value="SPECIFIC-AUTHOR" >Specific Author</option> 
      <option value="SRCTITLEPLUS" >Source Title</option> 
      <option value="TITLE" >Title</option> 
      <option value="KEYWORDS" >Keywords</option> 
      <option value="ABSTRACT" >Abstract</option> 
      <option value="REFERENCES" >References</option> 
      <option value="ISSN" >ISSN</option> 
      <option value="ISBN" >ISBN</option> 
      <option value="AFFILIATION" >Affiliation</option> 
      <option value="FULL-TEXT" >Full Text</option> 
      </select> 
     </div> 
     <div class="searchFormField"> 
     <select name="addTerm" id="addTerm" size="1"> 
      <option value="0" selected > AND 
      <option value="1" > OR 
      <option value="2" > AND NOT 
      </select> 
     </div> 
     <div> 
     <input type="text" class="inputBox" name="addSearchText" id="addSearchText" value="" size="60" maxlength="256">&nbsp;&nbsp;in&nbsp;&nbsp; 
      <select name="addkeywordOpt" id="addkeywordOpt" size="1"> 
      <option value="ALL" selected >All Fields</option> 
      <option value="TITLE-ABSTR-KEY" >Abstract, Title, Keywords</option> 
      <option value="AUTHORS" >Authors</option> 
      <option value="SPECIFIC-AUTHOR" >Specific Author</option> 
      <option value="SRCTITLEPLUS" >Source Title</option> 
      <option value="TITLE" >Title</option> 
      <option value="KEYWORDS" >Keywords</option> 
      <option value="ABSTRACT" >Abstract</option> 
      <option value="REFERENCES" >References</option> 
      <option value="ISSN" >ISSN</option> 
      <option value="ISBN" >ISBN</option> 
      <option value="AFFILIATION" >Affiliation</option> 
      <option value="FULL-TEXT" >Full Text</option> 
      </select> 
     </div> 
     <div style="margin:5px 0;"> 
     <label class="searchFormLabel" for="source">Include</label> 


      <div style="float:left;"><input style="cursor: pointer;" type="checkbox" id="journals" name="source" value="srcJrl" CHECKED></div><div style="float:left;padding-top:2px;margin-right:5px;" class="astPad"><label for="journals">Journals</label></div> 


      <div style="float:left;"><input style="cursor: pointer;" type="checkbox" id="books" name="source" value="srcBk" CHECKED></div><div style="float:left;padding-top:2px;margin-right:5px;" class="astPad"><label for="books">All Books</label></div> 


     </div>  
     <div style="clear:both;"></div> 

     <div> 
     <label class="searchFormLabel" for="Subscribed">Source</label> 
     <select name="Subscribed" id="Subscribed" size="1" onChange="checkFavoriteJournals(this, 'sources','Y', '');" style="width:200px;"> 

      <option value="0" SELECTED>All sources</option> 


      <option value="1" >Subscribed sources</option> 


      <option value="2" >My Favorite sources</option> 

     </select> 
     </div>  


     <div style="clear:both;"></div> 
     <div> 
     <label class="searchFormLabel" for="Subject">Subject&nbsp;<span class="SDtxtNoteSmall">(select one or more)</span></label></div> 
     <div> 
     <div style="margin-right:10px;display:inline;float:left;"><SELECT Name="srcSel" Multiple Size = "4"><OPTION VALUE="1" SELECTED > - All Sciences -<OPTION VALUE="5"> Agricultural and Biological Sciences<OPTION VALUE="6"> Arts and Humanities<OPTION VALUE="18"> Biochemistry, Genetics and Molecular Biology<OPTION VALUE="7"> Business, Management and Accounting<OPTION VALUE="8"> Chemical Engineering<OPTION VALUE="9"> Chemistry<OPTION VALUE="11"> Computer Science<OPTION VALUE="12"> Decision Sciences<OPTION VALUE="13"> Earth and Planetary Sciences<OPTION VALUE="14"> Economics, Econometrics and Finance<OPTION VALUE="15"> Energy<OPTION VALUE="16"> Engineering<OPTION VALUE="17"> Environmental Science<OPTION VALUE="220"> Immunology and Microbiology<OPTION VALUE="19"> Materials Science<OPTION VALUE="20"> Mathematics<OPTION VALUE="21"> Medicine and Dentistry<OPTION VALUE="22"> Neuroscience<OPTION VALUE="466"> Nursing and Health Professions<OPTION VALUE="23"> Pharmacology, Toxicology and Pharmaceutical Science<OPTION VALUE="24"> Physics and Astronomy<OPTION VALUE="25"> Psychology<OPTION VALUE="26"> Social Sciences<OPTION VALUE="487"> Veterinary Science and Veterinary Medicine</SELECT></div> 
     <div class="txtSmall" style="display:inline;">Hold down the Ctrl key (or Apple Key) <br>to select multiple entries.</div> 
     </div> 
     <div style="clear:both;"></div> 

從這個我構建這個URL http://www.sciencedirect.com/science?_ob=MiamiSearchURL&_method=submitForm&_acct=C000053194&_temp=all_search.tmpl&md5=9e299e9289462d7805ab0a5dcc9cff5c&test_alid=&keywordOpt=TITLE-ABSTR-KEY&source=srcJrl=1&source=srcBk=1&Subscribed=0&onchange=Y&srcSel=1&DateOpt=2&SearchText=test

在& [inputname]其中一期工程= [值] &基礎

哪個應根據我的標準搜索「測試」,不幸的是它會返回一個錯誤「必須選擇一個源」,源設置爲URL的Subscribed = 0部分,似乎正在工作,因爲改變價值ch時代來源。

源等領域之間的區別在於源是它採用不

所以我的問題是我怎麼更改URL,使其返回結果。

+0

查詢得到處理在哪裏?你能告訴我們那個代碼嗎? – Ryan

+0

OP只是想「調用」sciencedirect.com搜索,據我所知。 – codeling

+0

這也是我的問題,如果'source'字段使用'$ _POST'變量而不是'$ _GET'變量,這可能會導致程序停止。另外,在重新閱讀這個問題時,我意識到sciencedirect.com可能不是falcs projet--這就是我最初的看法。 – Ryan

回答

0

它看起來像科學直接使用一個變量,每個搜索具有唯一值(在您的示例中,md5 = 9e299e9289462d7805ab0a5dcc9cff5c)。即使您執行相同的搜索,該值也會更改。

我沒有做過任何詳細的調查,但是如果他們在他們身邊做了一些檢查(如檢查cookie,ip地址等),即使不是不可能做到也很困難。