0

I need to import some data from MySQL database to analyze and display using Processing I have PHP code to query and get data from MySQL. Is there any way I could call my PHP from processing? Appreciate your help.

Thanks in advance, Hasala

3
  • Can u call an http url? If so u are in Commented Jul 20, 2015 at 5:25
  • @DrewPierce yes, I can call even a http *.php file. But I am unable to call this https:// *.php file. Commented Jul 20, 2015 at 6:23
  • It's a socket and stream. Not an elegant protocol ssl/tls engine that's for sure Commented Jul 20, 2015 at 6:27

1 Answer 1

1

This below is a total poach from internet. I wouldn't know Processing if it fell on my head.

So yes it seems quite possible.

String ip="12.215.42.19";
String[] data=loadStrings("http://api.hostip.info/get_html.php?position=true&ip="+ip);
//will give an array of strings, one per line e.g.
/*
data[0]="Country: UNITED STATES (US)"
data[1]="City: Sugar Grove, IL"
data[2]=""
data[3]="Latitude: 41.7696"
data[4]="Longitude: -88.4588"
data[5]="IP: 12.215.42.19"
*/

Edit: Pretend the below .html is a .php

String lines[] = loadStrings("http://processing.org/about/index.html");
println("there are " + lines.length + " lines");
for (int i = 0 ; i < lines.length; i++) {
  println(lines[i]);

From:

https://processing.org/reference/loadStrings_.html

Sign up to request clarification or add additional context in comments.

9 Comments

I tried like you said. But I get an error saying javax.net.ssl.SSLProtocolException: My php is a link with https, would that be a problem? When I go to link from my browser it displays the result as array of Strings. What could be the issue?
Clearly SSL gets in the way and processing cannot handshake it
Sadly they named the language what they did. Messes up google search. It's like searching on the
So, is there anyway to fix this? I have no access to change any modifications from the server side. Any change I can do to client to fix this? Appreciate your help. Thanks.
You need to get something you can call that can talk ssl. Perhaps a third party library. A shell. I don't see Processing doing it natively.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.