httprequest() not a function

Just starting out? Need help? Post your questions and find answers here.
stevylake
User
User
Posts: 24
Joined: Fri Apr 05, 2019 6:50 pm

httprequest() not a function

Post by stevylake »

Hello, I have found several examples on this forum that use the
httprequest() function. It is documented in the online documentation but not on my local documentation.
When I try out the examples my version of purebasic gives an error that the function is not valid. This is the code I copied and pasted

Code: Select all

InitNetwork()

  HttpRequest = HTTPRequest(#PB_HTTP_Get, "https://www.google.com")
  If HttpRequest
    Debug "StatusCode: " + HTTPInfo(HTTPRequest, #PB_HTTP_StatusCode)
    Debug "Response: " + HTTPInfo(HTTPRequest, #PB_HTTP_Response)
    
    FinishHTTP(HTTPRequest)
  Else
    Debug "Request creation failed"
  EndIf
Any help with thanks. Stephen
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Re: httprequest() not a function

Post by BarryG »

Sounds like you have an old version of PureBasic. Are you running the latest? If so, maybe re-install it over itself, to ensure all the relevant library files are there.
stevylake
User
User
Posts: 24
Joined: Fri Apr 05, 2019 6:50 pm

Re: httprequest() not a function

Post by stevylake »

Solved. Thanks. I wasn't running a too older version just one version (5.62) back but installed the 5.7 version and all good. Thanks again.
Post Reply