$a = $_POST['a'] // a and b need to come from C++
$b = $_POST['b']
// do stuff with $a & $b
echo($c) // a string, under 100 regular ASCII chars, nothing special
--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
char _lastResponse[1024] = { '\0' };int _wgetLock = 0;bool _success = false;
void _net_ems_onload(void * arg, void * data, int size){ if(size > 1023) size = 1023;
RLog("EMS in onload callback, got response, size = %d", size);
memcpy(_lastResponse, data, size); _lastResponse[size] = '\0'; _success = true; _wgetLock = 0;}
void _net_ems_onerror(void * arg){ RLog("EMS onerror callback :("); _success = false; _wgetLock = 0;}
bool net_httpGet(const char * page, const char * key1, const char * val1, const char * key2, const char * val2, const char * key3, const char * val3, char * response){ if(page == NULL) return false;
RLog("EMS httpGet entry, target = \"%s\"", page);
//while(_wgetLock) { cu_sleep(100); }
RLog("EMS Lock passed, pausing main loop");
_wgetLock = 1; emscripten_pause_main_loop();
char request[1024] = { 0 }; memset(_lastResponse, 0, 1024);
strcpy(request, page);
RLog("EMS Preparing request");
if(key1 != NULL && key2 != NULL) { strcat(request, "?"); strcat(request, key1); strcat(request, "="); strcat(request, val1);
if(key2 != NULL && val2 != NULL) { strcat(request, "&"); strcat(request, key2); strcat(request, "="); strcat(request, val2);
if(key3 != NULL && val3 != NULL) { strcat(request, "&"); strcat(request, key3); strcat(request, "="); strcat(request, val3); } } }
//strcpy(request, "http://www.google.com");
_success = false;
RLog("EMS Full request = \"%s\"", request); RLog("EMS Starting async wget...");
emscripten_async_wget_data(request, NULL, _net_ems_onload, _net_ems_onerror);
RLog("EMS Waiting for async wget to complete...");
while(_wgetLock) { cu_sleep(100); }
RLog("EMS Async complete! Resuming main loop");
emscripten_resume_main_loop();
if(_success) { RLog("EMS Success! Response : \"%s\"", _lastResponse); strcpy(response, _lastResponse); return true; } else { RLog("EMS Fail :("); return false; }}
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
emscripten_async_wget2_data: function(url, request, param, arg, free, onload, onerror, onprogress) { var _url = Pointer_stringify(url); var _request = Pointer_stringify(request); var _param = Pointer_stringify(param);
var http = new XMLHttpRequest(); http.open(_request, _url, true); http.responseType = 'arraybuffer';
var handle = Browser.getNextWgetRequestHandle();
// LOAD http.onload = function http_onload(e) { if (http.status == 200 || _url.substr(0,4).toLowerCase() != "http") { var byteArray = new Uint8Array(http.response); var buffer = _malloc(byteArray.length); HEAPU8.set(byteArray, buffer); if (onload) Runtime.dynCall('viiii', onload, [handle, arg, buffer, byteArray.length]); if (free) _free(buffer); } else { if (onerror) Runtime.dynCall('viiii', onerror, [handle, arg, http.status, http.statusText]); } delete Browser.wgetRequests[handle]; };
// ERROR http.onerror = function http_onerror(e) { if (onerror) { Runtime.dynCall('viiii', onerror, [handle, arg, http.status, http.statusText]); <--- HERE! } delete Browser.wgetRequests[handle]; };
// PROGRESS http.onprogress = function http_onprogress(e) { if (onprogress) Runtime.dynCall('viiii', onprogress, [handle, arg, e.loaded, e.lengthComputable || e.lengthComputable === undefined ? e.total : 0]); };
// ABORT http.onabort = function http_onabort(e) { delete Browser.wgetRequests[handle]; };
// Useful because the browser can limit the number of redirection try { if (http.channel instanceof Ci.nsIHttpChannel) http.channel.redirectionLimit = 0; } catch (ex) { /* whatever */ }
if (_request == "POST") { //Send the proper header information along with the request http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", _param.length); http.setRequestHeader("Connection", "close"); http.send(_param); } else { http.send(null); }
Browser.wgetRequests[handle] = http;
return handle;},
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
XMLHttpRequest
request from client and your server part. So you might write a simple test case in javascript to make things work with your php part ( I never returned anything xml from server though, except for files, so again -I'm sorry - let anyone else shed some light here, maybe a problem is in misconfiguration between what you send and what you receive ).To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
--You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/x1k3yNOBjco/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.