Форум: "Сети";
Текущий архив: 2006.07.09;
Скачать: [xml.tar.bz2];
ВнизПарсинг Url a Найти похожие ветки
← →
rOOse © (2006-03-07 08:31) [0]Нужно с линка http://www.somesite.com/abc/def/index.html
вытащить http://www.somesite.com это самому парсить надо или есть какие-то методы?
← →
Dmitrij_K (2006-03-07 10:03) [1]В indy есть класс TidURL или TidURI? уже точно не помню
← →
Dmitrij_K (2006-03-07 10:13) [2]Удалено модератором
← →
Dmitrij_K (2006-03-07 10:14) [3]Удалено модератором
← →
Dmitrij_K (2006-03-07 10:30) [4]Удалено модератором
← →
seeker © (2006-03-07 10:38) [5]
function InternalInternetCrackUrl( Url: string; // string that contains the canonical URL to crack
options:TInternetURLCrackOptions; // icoDECODE: Converts encoded characters back to their normal form.
// icoESCAPE Converts all escape sequences (%xx) to their corresponding characters
var UrlComponents: TURL_Components // TURLCOMPONENTS structure that receives the URL components
): boolean; // Returns TRUE if the function succeeds, or FALSE otherwise.
var // To get extended error information, "call GetLastError"
dwFlags: DWORD; // that contains the flags controlling the operation. This can be one of the following values: ICU_DECODE (Converts encoded characters back to their normal form.), ICU_ESCAPE (Converts all escape sequences (%xx) to their corresponding characters)
aUrlComponents: TURLComponents;
begin
dwFlags:=0;
if icoDECODE in options then
dwFlags:=dwFlags or ICU_DECODE;
if icoESCAPE in options then
dwFlags:=dwFlags or ICU_ESCAPE;
aUrlComponents.dwSchemeLength:=1024;
aUrlComponents.dwHostNameLength:=1024;
aUrlComponents.dwUserNameLength:=1024;
aUrlComponents.dwPasswordLength:=1024;
aUrlComponents.dwUrlPathLength:=1024;
aUrlComponents.dwExtraInfoLength:=1024;
aUrlComponents.dwStructSize:=sizeof(aUrlComponents);
getMem(aUrlComponents.lpszScheme,aUrlComponents.dwSchemeLength);
getMem(aUrlComponents.lpszHostName,aUrlComponents.dwHostNameLength);
getMem(aUrlComponents.lpszUserName,aUrlComponents.dwUserNameLength);
getMem(aUrlComponents.lpszPassword,aUrlComponents.dwPasswordLength);
getMem(aUrlComponents.lpszUrlPath,aUrlComponents.dwUrlPathLength);
getMem(aUrlComponents.lpszExtraInfo,aUrlComponents.dwExtraInfoLength);
try
result:=boolean(InternetCrackUrl(pchar(Url),0, dwFlags,aUrlComponents));
if result then
begin
UrlComponents.Scheme:=string(aUrlComponents.lpszScheme);
UrlComponents.nScheme:=APISchemeEnumToNative(aUrlComponents.nScheme);
UrlComponents.HostName:=string(aUrlComponents.lpszHostName);
UrlComponents.nPort:=aUrlComponents.nPort;
UrlComponents.pad:=aUrlComponents.pad;
UrlComponents.UserName:=string(aUrlComponents.lpszUserName);
UrlComponents.Password:=string(aUrlComponents.lpszPassword);
UrlComponents.UrlPath:=string(aUrlComponents.lpszUrlPath);
UrlComponents.ExtraInfo:=string(aUrlComponents.lpszExtraInfo);
end;
finally
freeMem(aUrlComponents.lpszScheme,aUrlComponents.dwSchemeLength);
freeMem(aUrlComponents.lpszHostName,aUrlComponents.dwHostNameLength);
freeMem(aUrlComponents.lpszUserName,aUrlComponents.dwUserNameLength);
freeMem(aUrlComponents.lpszPassword,aUrlComponents.dwPasswordLength);
freeMem(aUrlComponents.lpszUrlPath,aUrlComponents.dwUrlPathLength);
freeMem(aUrlComponents.lpszExtraInfo,aUrlComponents.dwExtraInfoLength);
end;
end;
← →
rOOse © (2006-03-07 12:30) [6]
> [5] seeker © (07.03.06 10:38)
Спасибо.
Страницы: 1 вся ветка
Форум: "Сети";
Текущий архив: 2006.07.09;
Скачать: [xml.tar.bz2];
Память: 0.46 MB
Время: 0.013 c