Announcement
Collapse
No announcement yet.
TCP Open Example Code in Help Does Not Work
Collapse
X
-
You wouldn't know which setting they changed as I'm having the same problem with my own Abyss web site?Last edited by Graham McPhee; 19 Oct 2009, 04:15 PM.
-
-
Solution found.
My ISP folks changed a mod_security setting, which seems to do the trick. The Help example now works with pages/files from my site.
Leave a comment:
-
-
Just as an aside, you should typically not be specifying the referer header like that example is doing. It would tell any and all webservers that the request to them originated from the PowerBasic website, which is obviously not correct. You'd also typically want to change the User-Agent header value as well. And yes, it's not necessary to specify a complete URL as the resource. It could simply be defined as "/path/to/some/file.html" instead.
Leave a comment:
-
-
Mike, thanks for the response.
I also heard from Steve at PB Inc.
True, this does not work for your site, but works for all other sites
BTW, the full URL or the version without the leading "http://.../" seems to work fine with File$ - just like the Help example.
Leave a comment:
-
-
TCP Open Example Code in Help Does Not Work
I'm finally getting around to trying out the PowerBASIC TCP capabilities - and wouldn't you know that one of the first examples I try (Help Topic TCP Open) doesn't work.
The example code, even corrected for valid Site$/File$ values (the File$ in the example does not exist) I still get an error from the server:
Your browser sent a request this server could not understand.
Code:' Client TCP/IP example - retrieve a web page #COMPILE EXE FUNCTION PBMAIN() AS LONG LOCAL Buffer$, Site$ LOCAL Entire_page$, Htmlfile$, Link$ LOCAL Pos&, Length& Site$ = "www.powerbasic.com" File$ = "http://www.powerbasic.com/support/forums/Forum2/HTML/000031.html" ' Connecting... TCP OPEN "http" AT Site$ AS #1 TIMEOUT 60000 ' Could we connect to site? IF ERR THEN BEEP EXIT FUNCTION END IF ' Send the GET request... TCP PRINT #1, "GET " & File$ & " HTTP/1.0" TCP PRINT #1, "Referer: http://www.powerbasic.com/" TCP PRINT #1, "User-Agent: TCP OPEN Example (www.powerbasic.com) TCP PRINT #1, "" ' Retrieve the page... DO TCP RECV #1, 4096, Buffer$ Entire_page = Entire_page + Buffer$ LOOP WHILE ISTRUE LEN(Buffer$) AND ISFALSE ERR ' Close the TCP/IP port... TCP CLOSE #1 END FUNCTION
now when I run the example from Help, it works fine and I can see the page from the PowerBASIC web site.
But a page from my web site does not work - as before, giving the same error message.
Site$ = "www.garybeene.com"
File$ = "http://www.garybeene.com/files/gbsnippets.msg"Last edited by Gary Beene; 29 Sep 2009, 11:19 PM.Tags: None
-
Leave a comment: