login about faq

I must be doing something really stupid... This code fragment shows how I access two web pages on two different sites:

const char* const pszContents = http.quickGetStr (pszWebPage);
TRACE ("%s",pszContents) ;

If pszWebPage is "http://www.ransen.com/default.htm" then quickGetStr returns the contents correctly.

If pszWebPage is "http://www.dxftosvg.com/default.html" then quickGetStr returns a 404 page from the HostGator hoster.

Both pages work as they should in a browser. The first URL is on a Windows based server. The second is on a HostGator server, which is unix (I think) and is case sensitive, but apart from that I cannot see why the second call should not work.

asked Dec 28 '13 at 02:53

ofransen's gravatar image

ofransen
168813


Hello Owen,

Could it be that http://www.dxftosvg.com/default.html is some kind of .htaccess redirect? Does lastErrorText say something interesting?

Gert

link

answered Dec 28 '13 at 04:21

Gert's gravatar image

Gert ♦
629141824

Here is what the LastErrorText tells me:

ChilkatLog:
  QuickGetStr:
    DllDate: Aug 24 2012
    UnlockPrefix: etc etc
    Username: etc etc
    Architecture: Little Endian; 32-bit
    Language: Visual C++ 10.0
    VerboseLogging: 0
    VerboseLogging: 0
    QuickReq:
      url: http://www.dxftosvg.com/default.html
      QuickGetToOutput_OnExisting:
        qGet_1:
          simpleHttpRequest_3:
            httpMethod: GET
            requestUrl: http://www.dxftosvg.com/default.html
            Connecting to web server...
            httpServer: www.dxftosvg.com
            port: 80
            ConnectTimeoutMs_1: 10000
            calling ConnectSocket2
            IPV6 enabled connect with NO heartbeat.
            connectingTo: www.dxftosvg.com
            dnsCacheLookup: www.dxftosvg.com
            Resolving domain name (IPV4)
            GetHostByNameHB_ipv4: Elapsed time: 374 millisec
            myIP_1: 192.168.1.101
            myPort_1: 49673
            connect successful
link

answered Dec 28 '13 at 07:32

ofransen's gravatar image

ofransen
168813

First thing to do is test with the latest version of the library - the version you are using is fairly old (Aug 2012). Your unlock code is permanent, so it will work with the latest version.

(Dec 28 '13 at 14:27) jpbro ♦

I'll try that. I don't think that is the problem, maybe I'm setting up CkHttp incorrectly or not completely.

(Dec 29 '13 at 02:26) ofransen

Someone how knows more than me has dug deeper and here is the response he got:

HTTP/1.1 406 Not Acceptable
Date: Sat, 28 Dec 2013 17:53:24 GMT
Server: Apache
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1

<head><title>Not Acceptable!</title></head><body><h1>Not 
Acceptable!</h1><p>An appropriate representation of the requested 
resource could not be found on this server. This error was generated by 
Mod_Security.</p></body></html>

He's then suggsted that: "Apparently, Hostgator is using Mod_Security that detects your request as not valid in some way. Maybe the User Agent is missing or is not standard?maybe the user agent is missing or not standard"

Should I be using a different function rather than quickGetStr?

link

answered Dec 29 '13 at 02:13

ofransen's gravatar image

ofransen
168813

edited Dec 29 '13 at 02:27

1

Try setting the MimicIe property to 1 and see if that helps. Weird that HostGator would show a 404 page for a 406 error though!

(Dec 29 '13 at 09:17) jpbro ♦

Magic! That did the trick! Many thanks. I can only assume that HostGator has some security which rejects http requests from "non humans"

link

answered Dec 29 '13 at 11:00

ofransen's gravatar image

ofransen
168813

Me too. When i put url : http://www.w3.org/Protocols/. The html return correct content. But when i put http://blackforever.net/ the string html return "" (NULL) although connected successful. Anybody can help with other function ? I am using thew newest verion Jul 9 2013 in VC6.0

Thank a lot

link

answered Jan 28 '14 at 02:01

htnet2005's gravatar image

htnet2005
1123

edited Jan 28 '14 at 02:05

Have you tried setting MimicIe as suggested to me halfway down this page? It worked for me...

link

answered Jan 29 '14 at 14:12

ofransen's gravatar image

ofransen
168813

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×9
×1
×1

Asked: Dec 28 '13 at 02:53

Seen: 165,438 times

Last updated: Jan 29 '14 at 14:12

powered by OSQA