Pulling Data from .php Site

Hey folks,

I just got my Spark a few days ago, and I’m itching to dig in. I’m looking to create a project where a lamp illuminates whenever new data appears on a plaintext .php page. While I have a decent understanding of how to go about the practical portions of creating the lamp (and illuminating it when given a certain go-ahead), I’m completely lost when it comes to accessing the data from the site in question. I don’t have any access to said site other than as a user. Could I accomplish this with just my Spark Core, or would I have to have something else running? If so, how should I go about it?

It can be done with a Spark Core with no other servers or services in the middle. Check out the HttpClient library and see if that does what you need. If not, let us know and we can help you hack this together!

1 Like

Thanks, @wgbartley ,

Per your suggestion, I went ahead and tried to work with the HttpClient library. It seems to be exactly what I need for this project, but when I go to verify the project in the Spark IDE, I get the following error:

HttpClient.o: In function `HttpClient::request(http_request_t&, http_response_t&, http_header_t*, char const*)': /spark/compile_server/shared/workspace/worker_2/core-firmware/build/HttpClient.cpp:256: undefined reference to `String::operator=(String&&)' collect2: error: ld returned 1 exit status make: *** [36d3337fdca16ecb28fefeb6102a5be602b400f44957bc5fe2e8c10b2258.elf] Error 1

Any suggestions? At the moment, I’m just using the exact files that are found on the library’s Github.

@Shado_Temple Did you use a local build environment or are you compiling on Spark’s servers? It looks to me like a linker error, so you might have missed to add the line below to your build.mk file. I’m not sure how to do it using the Web IDE unfortunately.

CPPSRC += $(TARGET_SRC_PATH)/HttpClient.cpp