Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years ago.
Getting errors on Fetch
Getting error on HTTP Get. From the source code, I only changed line 14 which is setting the APN.
All the initialization modem commands seem to work fine. I do get an IP address assigned as expected.
Code Section............
//GET data printf("\nTrying to fetch page...\n"); int ret = http.get("http://mbed.org/media/uploads/donatien/hello.txt", str, 128); if (!ret) { printf("Page fetched successfully - read %d characters\n", strlen(str)); printf("Result: %s\n", str); } else { printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); }
But then i get the following error messages...
"Trying to fetch page... Error - ret = 3 - HTTP return code = 301 Trying to post data... Error - ret = 3 - HTTP return code = 200 Trying to put resource... Error - ret = 3 - HTTP return code = 200 Trying to delete resource... Error - ret = 3 - HTTP return code = 200"
Any suggestions on how I debug at this point?
Question relating to:
1 Answer
9 years ago.
mbed.org is returning a 301 which is redirecting you to the same path on developer.mbed.org.
developer.mbed.org also is redirecting from http to https.
You might need to find a different file to test with.
So based on your answer, I changed the URL of the GET to my own server and got that step working fine. But what about the POST? The SW is attempting to POST to httpbin.org. That shouldn't be redirecting to https.
messages... Trying to post data... Error - ret = 3 - HTTP return code = 200
posted by 14 May 2015
I've taken the liberty of putting some
posted by Stephen Paulger 15 May 2015<<code>>
tags in your question to make it a little more readable.