I am very lazy to write any post. To be frank, I don’t find anything to write
Today I found something to write about. It’s nothing, but some bunch of codes. I’ll describe them, they are self explanatory. The idea is to write code and compile them On-The-Cloud. It’s actually using “IDE One” api to compile any programming source code, and give the result back. It’s useful in the devices where you can’t use any compiler, like mobile phones. There are already many applications for mobile that works the same way. Today I just wrote it in PHP. It uses SOAP protocol to communicate to the server. Enough talks
<?php
$user = 'tareq'; //--> API username
$pass = '********'; //--> API password
$lang = 1; //--> Source Language Code; Here is 1 => C++
$code = '#include<stdio.h>
int main() {
printf("hello");
return 0;
}
'; //--> Source Code
$input = '';
$run = true;
$private = false;
//create new SoapClient
$client = new SoapClient( "http://ideone.com/api/1/service.wsdl" );
//create new submission
$result = $client->createSubmission( $user, $pass, $code, $lang, $input, $run, $private );
//if submission is OK, get the status
if ( $result['error'] == 'OK' ) {
$status = $client->getSubmissionStatus( $user, $pass, $result['link'] );
if ( $status['error'] == 'OK' ) {
//check if the status is 0, otherwise getSubmissionStatus again
while ( $status['status'] != 0 ) {
sleep( 3 ); //sleep 3 seconds
$status = $client->getSubmissionStatus( $user, $pass, $result['link'] );
}
//finally get the submission results
$details = $client->getSubmissionDetails( $user, $pass, $result['link'], true, true, true, true, true );
if ( $details['error'] == 'OK' ) {
var_dump( $details );
} else {
//we got some error
var_dump( $details );
}
} else {
//we got some error
var_dump( $status );
}
} else {
//we got some error
var_dump( $result );
}
Here is a working demo. It might be buggy, may be you could help me to find those bugs
Sounds interesting. Will check it tonight. Thanks
Hi
I cant seem to figure how to do this.
I created a subdomain /ide then I added the code above to a .php file edit the username and password bit, but nothing seems to be working..
Kindly help.
Thank you.
Thank you! It helped me a lot because I don’t understand how to communicate to Ideone API using SOAP protocol.
Thank you.
Happy new year 2012!
Hi could you pls guide me how to add ideone api to my website
Thanks a lot man! I got it working on my end.
I used their api for our small class project.
I don’t know ajax, so the result of the submission is posted on a separate page.
Would you mind making the your example opensource? It’ll really help a lot!
Thanks!
or at least, may you care to share your code for the process.php?
I really want to implement something just like in your example.
Thanks!
Here you go https://github.com/tareq1988/ideone-compiler
Forked! Thanks a bunch
Hello:
how could I pass these files to a MVC model?
Shanks
It’s not that difficult, you could wrap the code in a function and move it to a class.
help, I work with codeigniter ,:(
Fahim Murshed ! I need your email adress my friend .
From Turkey…
your sample was very good sir. I really admire your work.
thank you very much, it helped me understand the ideone api.
thank you sir.
Hello:
Locate the files in the www folder and activate the php.ini localhost soap, but to run it shows me the following error:
Something went wrong
HELP!!!
Hi.. My Final Projct is exactly yours ideone-compiler…
pls help me in ths regard…. i dnt knw hw to use the projct of urs.. its nt compiln anythn to me.. wat chnges to b done to do it compile.. pls hlp..im in 11th hour…
It was a fun project and the source code is available on github. There is also the demo here. You shouldn’t have any problem.
urs is workn nw sir,, i need in “c” u did in c++,, can i get ur full support in my projct.. just for “c” alone sir
Sir i need for “C” alone… can u help me out in ths..
not a fun projct.. my Final Year Degree project.. mark oriented.. save me in ths aspect.. u did for c++, can i knw hw to do for “c”,,, sir need ur kind hlp
Change the
langto 11, it’ll work with C.I need to implement this in MVC, please help
The code example is right here, so try to adapt it to MVC pattern. I can’t help more.