Hello skinkairewalker.
You can't run HTTPRequest from the IDE because the internal server does not support PHP.
-Do not use the Debug function
-Use The Compile menu -> Transfer
-Launch The result from your local or remote server.
■ Example with this codes.
-receivedata3.php
Code: Select all
<?php
$array = array("Peter"=>"35","Ben"=>"37","Joe"=>"43");
echo json_encode($array);
?>
-httprequest.pb
Code: Select all
Enumeration
#Json
#mainForm
#Debug
EndEnumeration
Declare HttpGetEvent(Success, Result$)
OpenWindow(#mainForm, 0, 0, 0, 0, "Demo HTTPRequest()", #PB_Window_Background)
EditorGadget(#Debug, 0, 0, WindowWidth(#mainForm), WindowHeight(#mainForm))
HTTPRequest(#PB_HTTP_Get, "receivedata3.php", "", @HttpGetEvent())
Procedure HttpGetEvent(Success, Result$)
Protected i, buffer.s
If Success
If ParseJSON(#Json, Result$)
; transfer the php array to a map
NewMap Values.l()
ExtractJSONMap(JSONValue(#Json), Values())
; display the result
ForEach Values()
buffer + MapKey(Values()) + " = " + Values() + #CRLF$
Next Values()
SetGadgetText(#Debug, Buffer)
EndIf
Else
SetGadgetText(#Debug, "HTTPRequest(): Error")
EndIf
EndProcedure
■ Demo (Url Remove)