logowanie do strony UPS.com ?

0

witam... slecze juz troche nad tym problemem, ale niestety nie moge sobie poradzic z zalogowaniem sie do serwisu UPS.com

Po stronie przeglądarki mam forme:

         <form name="LoginPage" method="post" action="/one-to-one/login">
		    <input name="system.action" value="login" type="hidden">
<input name="system.returnto" value="/myups/finishlogin?loc=pl_PL&amp;amp;auto=0&amp;amp;returnto=https://www.ups.com/uis/create?loc=pl_PL&amp;amp;WT.svl=PNRO_L1&amp;amp;appid=UIS" type="hidden">
<input name="appid" value="UIS" type="hidden">
<input name="origReturnTo" value="https://www.ups.com/uis/create?loc=pl_PL&amp;WT.svl=PNRO_L1&amp;appid=UIS" type="hidden">
<input name="returnToFirst" value="/myups/finishlogin" type="hidden">
<input name="fullReturnTo" value="/myups/finishlogin?loc=pl_PL&amp;auto=0&amp;returnto=https://www.ups.com/uis/create?loc=pl_PL&amp;WT.svl=PNRO_L1&amp;appid=UIS" type="hidden">
<input name="loc" value="pl_PL" type="hidden">
<!-- Version: 9.02.09 -->
<!-- Build Date: Thu, Feb 12 2009 16:08 -->
<input name="system.screenname" value="UIS" type="hidden">
<input name="system.forwardname" value="LoginCustomForSSO" type="hidden">

<input name="system.isLoggedIn" value="0" type="hidden">
 
            <!-- <input type="hidden" name="submitAction" value="" />  --> 
            <input name="uid" value="" type="hidden"> 
            <input name="password" value="" type="hidden"> 
            <input name="returnto" value="" type="hidden">  
            <input name="sysid" value="myups" type="hidden"> 
            <input name="method" value="login" type="hidden">
            <input name="bean.id" value="some" type="hidden">

			<table class="mod-clr" border="0" cellpadding="0" cellspacing="0" width="100%">
				<tbody><tr>
					<td class="mod-head-clr"><img alt="" src="/img/1.gif" border="0" width="8" height="4"></td> 
					<td class="mod-head-clr" width="100%" height="20">


				  
					
				  
					<span class="whitesubheadbold">
						Mój UPS
					</span>

  				     
				  

				</td></tr>
			</tbody></table>
			<table class="mod-clr" border="0" cellpadding="0" cellspacing="0" width="100%">
				<tbody><tr>
					<td colspan="2"><img alt="" src="/img/1.gif" border="0" width="1" height="8"></td>

				</tr>
				<tr>
					<td colspan="2">
						<div class="modulepad">
								
									Zaloguj lub zarejestruj się, aby uzyskać dostęp do funkcji UPS Wysyłka Internetowa
									<br><br>
                                
							<span class="bold">Identyfikator użytkownika:</span>
							<br>
							<input name="bean.uid" value="" size="16" tabindex="1" maxlength="16" type="text">

                            <br>
                                 <input name="bean.autopop" value="1" type="checkbox"> 
				
					
					                               
                            	<a href="javascript:helpModLvl('http://www.ups.com/content/pl/pl/register/remember_me.html')">Pamiętaj Mój ID Użytkownika na tym komputerze<img src="/img/icn_help_blue.gif" alt="" border="0" width="9" height="9"></a>
   				   
				
							<br><br>
							<span class="bold">Hasło:</span>
							<br>
							<input name="bean.password" value="" size="16" tabindex="2" maxlength="20" type="password">
							<br><br>

							Logując się do witryny ups.com, wyrażasz zgodę na warunki, które określa <a href="http://www.ups.com/content/pl/pl/resources/service/terms/technology_agreement.html">Umowa o dostarczanie rozwiązań technologicznych z firmą UPS.</a>

							<br><br>
							<div class="modpadarrow">&nbsp;<img alt="" src="/img/icn_arrow_blue.gif" border="0" width="10" height="10">

								<a href="/myups/forgotpassword?loc=pl_PL&amp;returnto=%2Fmyups%2Ffinishlogin%3Floc%3Dpl_PL%26amp%3Bauto%3D0%26amp%3Breturnto%3Dhttps%3A%2F%2Fwww.ups.com%2Fuis%2Fcreate%3Floc%3Dpl_PL%26amp%3BWT.svl%3DPNRO_L1%26amp%3Bappid%3DUIS">
									Nie pamiętam identyfikatora użytkownika lub hasła
								</a>
							</div>

						</div>
					</td>
				</tr>
			</tbody></table>
			<!--- END Table: Form Input(Parent:Formatting Table) -->
			<!--- Begin Table: Form Control Buttons(Parent:Formatting Table) -->
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
					<tbody><tr>
						<td class="mod-clr" colspan="2" height="10"><img alt="" src="/img/1.gif" width="1" height="10"></td>

					</tr>
					<tr>
						<td colspan="2" bgcolor="#ffffff" height="1"><img alt="" src="/img/1.gif" width="1" height="1"></td>
					</tr>
					<tr>
						<td class="mod-bar" width="100%">&nbsp;</td>

						<td class="mod-bar" align="right" nowrap="nowrap"><a href="#" onclick="javascript:submitToSSOLogin(); return false"><input class="btn_a" name="LOG IN" value="Zaloguj się" title="Zaloguj się" type="submit"></a></td>
					</tr>

			</tbody></table>
			<!--- End Table: Form Control Buttons(Parent:Formatting Table) -->
			</form>

a wszystko chyba sprowadza się do:

<input name="bean.uid" value="" size="16" tabindex="1" maxlength="16" type="text">
<input name="bean.password" value="" size="16" tabindex="2" maxlength="20" type="password">
<input class="btn_a" name="LOG IN" value="Zaloguj się" title="Zaloguj się" type="submit">
0

teoretycznie trzeba wysłać wszystkie inputy które mają określony name choć czasem wystarcza mniej, zależy od tego czy to co jest po drugiej stronie kabla przyjmie takie okrojone
wysyłasz określoną metodą na określony adres ( w form jest określone to
w Indy jest to dość proste ( zdobądź IdHTTP i moduły które to wymaga, czyli najlepiej całe Indy )

i na przykład tak:

w uses

IdHTTP in 'c:\tu mam indy\IdHTTP.pas';

zmienne

var HTTPClient:TIdHTTPClient;

zanim zaczniesz coś robić

HTTPClient:=TIdHTTPClient.Create(nil);

a jak skończysz

HTTPClient.Free();

i wysyłanie formularza

var
  input,output:TStringList;
begin

  input:=TStringList.Create();
  output:=TStringList.Create();

  input.Add('nazwainputa=wartość');
  i tak tyle razy ile trzeba ( z odpowiednimi danymi =] )

  output.Text:=HTTPClient.Post('adres jakiś tam',input);

  a jeśli jest Get a nie Post
 
  output.Text:=HTTPClient.Get('adresik?aa=zzz&bb=yyy......');

  robisz sobie coś otrzymanym kodem strony

  input.Free();
  output.Free();

end;
0

zapewne wlasnie trzeba bedzie wyslac wszystkie... i chyba za pomoca indy nie bardzo da sie tego zrobic, bo jak widac tych inputow jest troche...

a moze tak uzyc webbrowser ? kazac tylko wypelnic te dwa pola i wcisnac przycisk ? rozpracowalem ten kod jesli chodzi o allegro, ale po próbach przerobienai go na UPS nie chce to dobrze zadzialac... moze sa jakies propozycje co zrobic, aby to zadzialalo ?

funkcje mam taka:

function FillForm(WebBrowser: TWebBrowser; FieldName: string; Value: string): Boolean;
var
  i, j: Integer;
  FormItem: Variant;
begin
  Result := False;

  if WebBrowser.OleObject.Document.all.tags('FORM').Length = 0 then
  begin
    Exit;
  end;

  for I := 0 to WebBrowser.OleObject.Document.forms.Length - 1 do
  begin
    FormItem := WebBrowser.OleObject.Document.forms.Item(I);
    for j := 0 to FormItem.Length - 1 do
    begin
      try

        if FormItem.Item(j).Name = FieldName then
        begin
          FormItem.Item(j).Value := Value;
          Result := True;
        end;
      except
        Exit;
      end;
    end;
  end;
end;

potem daje w buttonie:

Webbrowser1.Navigate('https://ssl.allegro.pl/enter_login.php?request_server=allegro.pl');

nastepnie w DocumentComplete mam do wypelnienia pol:

begin
if(zaloguj = true) then begin
  FillForm(WebBrowser1, 'user_login', '***');
  FillForm(WebBrowser1, 'user_password', '***');
  zaloguj:=false;
       end;

potem wciasm przycisk za sprawa buttona:

var
  ovElements: OleVariant;
  i: Integer;
begin
  ovElements := WebBrowser1.OleObject.Document.forms.item(0).elements;
  for i := 0 to (ovElements.Length - 1) do
    if (ovElements.item(i).tagName = 'INPUT') and
      (ovElements.item(i).type = 'submit') and
      (ovElements.item(i).Value = 'Zaloguj się') then
      ovElements.item(i).Click;
end;
0

Indym się nie da? Niby czemu? Całkowicie się da, a skoro chcesz SSL to wbij w google IdHTTP SSL i otrzymasz gotowca =]
a TWebBrowser nie jest raczej zbyt bezpieczny i fajny bo w końcu to IE =]

0

to jak by to wygladalo w indy gdybym chcial wyslac wszystkie te dane jakie sa w formularzu ?
oraz czy mi jest potrzebne ssl do zalogowania sie do tego UPS ?
webbrowser nie jest bezpieczny ? tzn. mam z niego calkiem zrezygnowac czy jak ?

0

WebBrowser to po prostu przeglądarka Internet Explorer osadzony w programie, w tym stylu są zrobione np reklamy w komunikatorach ( sprytne ustawienie zabezpieczeń w IE i nie ma reklam =] )
W dodatku WB zrobi dużo zbędnych rzeczy, między innymi wyświetli tą stronkę, pobierze z sieci obrazki itd
IdHTTP to klient HTTP, pobierze tylko kod danej strony, żadnego zbędnego syfu, w dodatku nie wykonując pobranego kodu nie odpali np wrednego JavaScripta który zarzuci hordą nowych stron

Strona logowania na UPS.com jedzie w HTTPS czyli musisz wziąć SSL'a
a co do tego co wysyłasz do serwera to w tym co napisałem wcześniej masz jak to dodać =]

1 użytkowników online, w tym zalogowanych: 0, gości: 1