mIRC Homepage
Posted By: SpaceBoy socket connection to site issue - 10/11/03 12:55 AM
Hi

I have a script to retrieve headlines for my business channel and I'm trying to get it to work with this page:
http://framehosting.dowjonesnews.com/Home/Content_Main.asp?

The page dosn't require a login or anything to view on a browser, but when the script tries to get the line I want, all that is dumped into the variable is:

<body><h1>Object Moved</h1>This object may be found <a HREF="/NotLoggedIn.asp">here</a>.</body>

I've tried various combinations of the URL because there are longer versions of the address too when you right-click in IE and get the properties, but all return the same result. I'm wondering if there's some other kind of information the socket needs to send to get this particular page?

Thanks in advance for any assistance!
Posted By: Collective Re: socket connection to site issue - 10/11/03 02:02 AM
When I click that link it tells me I need to login, so either you've got the link wrong or you do need to be logged in.
Posted By: SpaceBoy Re: socket connection to site issue - 10/11/03 02:04 AM
ah ok thanks - weird cos it's never asked me to login - just goes straight to the news.

thanks for checking though!
Posted By: pleur Re: socket connection to site issue - 10/11/03 07:40 AM
that has to do with coockies


it's possible to request such a page though, it needs a bit of patiance and www.google.com (eerm, for searching a tut ofcourse) =:)
Posted By: SpaceBoy Re: socket connection to site issue - 10/11/03 07:44 AM
thanks but google won't help me here.
Posted By: Online Re: socket connection to site issue - 10/11/03 10:43 AM
When you are sending cookies to the server, they appear in this form:
  • Cookie: name=data; name=data
If you want to read your login information directly from the cookie file and send it along the HTTP request, you can put this code in your sockopen event, above the ending CRLF:
Code:
.fopen c c:\windows\cookies\user@[color:blue]&lt;cookie name&gt;[/color].txt
if $ferr {
  echo * Error: can't locate cookie file $fopen(c).fname
}
else {
  while !$feof {
    var %c = %c $+($fread(c),=,$fread(c),;)
[color:green]    ; move the pointer after the next '*'[/color]
    .fseek -r c \*
    .fseek -n c
  }
  sockwrite -n $sockname Cookie: %c
}
.fclose c
Posted By: SpaceBoy Re: socket connection to site issue - 11/11/03 04:40 AM
thanks Online - giving it a try now - though I'm getting the error message saying it can't find the file because the path has spaces in it:
C:\Documents and Settings\My Name\Cookies

tried underscores to fill in the gaps but it still can't locate it - any work arounds?
cheers.
Posted By: Iori Re: socket connection to site issue - 11/11/03 04:43 AM
Wrap it in "quotes"
"C:\Documents and Settings\My Name\Cookies\user@<cookie name>.txt"
Posted By: SpaceBoy Re: socket connection to site issue - 11/11/03 05:02 AM
thanks that bit now works - but after all that I'm still getting the not logged in message aghrrrrrr

oh wells!
Posted By: SpaceBoy Re: socket connection to site issue - 11/11/03 06:08 AM
if anyone can help any further, the base site the headlines are in is:
http://www.djnewswires.com

the frame in that page (which I assume the cookie is made from) can be launched into a separate window by right-clicking a headline and chose 'open in new window'. That's the page I'm trying to get the headlines from.

Thanks again - hope this can be cracked!! confused
© mIRC Discussion Forums