WHAT AM I DOING WRONG?! (httprequest)

Monkey Forums/Monkey Programming/WHAT AM I DOING WRONG?! (httprequest)

Playniax(Posted 2013) [#1]
Hi guys,

I need to get data from this link into my app: https://www.multipool.us/api.php

When I paste it into my browser I get something like this:

{"hashrate":{"ltc":"48736","nvc":"24066","ftc":"588663","mnc":"109987","wdc":"46331","dgc":"21495","lky":"0","arg":"1343","pxc":"0","mec":"3185","cap":"2069","trc":"34468"},"currency":null,"message":"Add your api_key to URL to get user data"}

But when I use httprequest it doesn't work. I get a message from the server that the document has moved?! I have send the link to Mark and he says it works with him on Android!?

I have tested it on Android and GLFW

WHAT AM I DOING WRONG?!


Capn Lee(Posted 2013) [#2]
since it works for Mark, can you provide a code example


marksibly(Posted 2013) [#3]
I just used this - adapted from httprequest sample in bananas/mak:



Works fine on Android here.

Note: Glfw DOES NOT support https yet.


chimaera(Posted 2013) [#4]
Hmm...This is a bit strange. Just tried Mark's code and compiled it for iOS. Running it through iOS Simulator and using xcode for debugging I am getting the following result for GET:

Http GET complete!
Status=404
ResponseText=<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /api.php was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>


When I tried it a few minutes later I received a message like Playniax that the document had moved...


marksibly(Posted 2013) [#5]
Works here on iOS too - simulator and device.

Can anyone else get it working or just me?!?


Playniax(Posted 2013) [#6]
Not working :( I get this:

BUILD SUCCESSFUL
Total time: 16 seconds
Starting: Intent { cmp=com.monkey/.MonkeyGame }
--------- beginning of /dev/log/main
E/AndroidRuntime(21006): /system/csc/feature.xml ==> cannot open file
--------- beginning of /dev/log/system
E/SensorManager(21014): registerListener :: handle = 0 name= BMA220 delay= 60 Listener= com.monkey.BBMonkeyGame@4a509660
E/SensorHAL( 173): Sensor Input open fd_compass=128 fd_accel=133
E/SensorManager(21014): =======>>>Sensor Thread RUNNING <<<========
E/SensorHAL(21014): __data_data_open 28 29
E/SensorHAL( 173): activate active=0 >new_sensors=1
E/SensorHAL( 173): Write /sys/class/input/input3/enable 1
E/SensorHAL( 173): Write acc delay /sys/class/input/input3/poll_delay <---60
I/[Monkey](21014): Http GET complete!
I/[Monkey](21014): Status=-1
I/[Monkey](21014): ResponseText=
E/Icing ( 9447): fdatasync not found, will use fsync


marksibly(Posted 2013) [#7]
Is it something to do with the way your device is configured? What device is it?

What is this site anyway? Have you tried another https site? eg: https://www.google.com


Playniax(Posted 2013) [#8]
It's a samsung GT-S5570 with Android 2.2.1

Maybe I need newer hardware?

The http://posttestserver.com POST and GET link works fine.


marksibly(Posted 2013) [#9]
Try GET https://www.google.com


Playniax(Posted 2013) [#10]
https://www.google.com works fine!?

It's almost like my link is working from New Zeeland but not from my area. Is there a redirection thing going on that we can not see? Maybe a time out problem. I noticed multipool can be slow.

I am puzzled :(


Playniax(Posted 2013) [#11]
Can anyone else get the above code with link working?!


CopperCircle(Posted 2013) [#12]
Hi, it worked for me on iOS/HTML5. I have a HTTPS compatible post module that Skn3 made for me before Monkey supported it, I could email you that to try if you want?


Playniax(Posted 2013) [#13]
Yeah thanks! That would be cool!


CopperCircle(Posted 2013) [#14]
Here it is:

http://www.coppercircle.co.uk/httppost.zip


DruggedBunny(Posted 2013) [#15]
I get this on GLFW:


Http GET bytes received=541
Http POST bytes received=334



... and this on HTML5:


Http GET bytes received=0
Http POST bytes received=141




Playniax(Posted 2013) [#16]
Thanks! I will test it!