SpiderBasic has a nice abstracted HTTP(s) request function HTTPRequest which I like to see in PureBasic also. This will make creating web service clients a bit more easier and less error-prone.
NB: With some manual work, and including a CURL lib, you may achieve the same, but that route should not be needed.
Same HTTPRequest function as in SpiderBasic
Re: Same HTTPRequest function as in SpiderBasic
ReceiveHTTPMemory() ?
■ Code Purebasic■ Code Php hello.php
■ Code Purebasic
Code: Select all
;ReceiveHTTPMemory : Send & Receive Data
Global FirstName.s, Name.s, DataSend.s
;My data
FirstName = "John"
Name = "Do"
;Format data
DataSend + "&firstname=" + URLEncoder(FirstName) + "&name=" + URLEncoder(Name)
InitNetwork()
;Send data
*Buffer = ReceiveHTTPMemory("falsam.com/racal/hello.php?" + DataSend)
;Receive data
If *Buffer
Debug PeekS(*Buffer, -1, #PB_UTF8)
Else
Debug "Failed"
EndIf
Code: Select all
<?php
$message="";
if (isset($_GET['firstname']) AND isset($_GET['name']))
{
$message = "Hello and welcome ".$_GET['firstname']." ".$_GET['name'];
}
echo $message;
?>
➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect.
Re: Same HTTPRequest function as in SpiderBasic
I'm aware of that one, but it's limited to GET operations. I need more than that, like HTTPS (SSL), headers and body (POST/PUT/PATCH).falsam wrote:ReceiveHTTPMemory() ?
See the SpiderBasic docs:
http://www.spiderbasic.com/documentatio ... quest.html
- the.weavster
- Addict
- Posts: 1537
- Joined: Thu Jul 03, 2003 6:53 pm
- Location: England
Re: Same HTTPRequest function as in SpiderBasic
+1
A good complement to PB's excellent CGI commands.
A good complement to PB's excellent CGI commands.