At present i am working on flight portal using PHP, SOAP , XML. We have taken the flight API from some 'X' provider. In that API they have given a sample file which contains international flight availability search Code. The code in that file is as below.
<HTML>
<HEAD>
<script language="Javascript">
function submit_search()
{
window.document.forms[0].action="http://URL/Avalability";
window.document.forms[0].submit();
}
</script>
</HEAD>
<BODY>
<form method="post">
XML Request: <input type="text" name="xmlRequest" id="fromcity" value="XML CODE FOR FLIGHT AVAILABILITY" />
<input type="button" name="SUBMIT" value="submit" onClick="submit_search();"/>
</form>
</BODY>
</HTML>
By executing the above code I am getting the Flight results in the other server . Now i want to get back that result into my file. How can we do that.
for your requirement you need to use ajax concept for getting the contents of those flight details from the server
this following url may helps you in this regard
http://www.java2s.com/Code/JavaScript/Development/functionloadstheXMLdocumentfromthespecifiedURL.htm
i hope it will provides a brief way to your solution
any comments are appreciated
Related
I am trying to do a small project (for personal use) and I am a little stuck with a particular part of this.
I have the following:
<html>
<head>
</head>
<body>
<form action="" method=post>
<input type="text" name="ipaddress"/>
<input name="submit" type=submit value="Command">
</form>
<?php
if(isset($_REQUEST['submit'])) {
$ipaddress = $_REQUEST['ipaddress'];
$output = shell_exec("ping -c 5 $ipaddress");
echo "<pre>$output</pre>\n";
}
?>
</body>
</html>
This is basically a test box in a form where a user can enter an IP address. This does work, and outputs the results on the page. What I'm trying to achieve is a live output of the response coming through as if this was being run from the CLI (essentially a line by line return of the output).
I have looked at various methods, including SSE but unfortunately, I've been unable to achieve this.
Can anyone please point me in the right direction or let me know where I'm going wrong?
Thanks
For a long time I love programming things that collects data for me. In Python I can make a GET request to a website and return the HTML of the website I would like to receive.
But in alot of websites you can POST something to the server and PHP would then respond/react on that sended data. How do I do this in Python?
For example, in the website at the bottom of this post I can insert my name and press the submit button to send the data to the PHP script. How do i do this in a socket with Python?
Also I really want to make it work without any libraries because ill be implementing it to other programs in other programming languages.
<html>
<body>
<form action="website.php" method="post">
<fieldset>
<br>
Enter your name:
<input type="text" name="un">
<center>
<input type=submit value=submit>
</center>
</fieldset>
</form>
</body>
</html>
I have a database with some numbers assigned to a fake account (PHP).
I try to contact the database (with success) and get the right result from the form.
My issue is that the form result open a new page and display there...
I would really like the result to be displayed IN the module I use to send the form OR anywhere else on the same page I used to send the form.
<!DOCTYPE html>
<html>
<body>
<form
method="post"
action="http://ggdbase.dx.am/impulseGetInfo.php"
target="_self">
Account name:<br>
<input type="text" name="name" value="derps">
<br>
<input type="submit" value="Click To Load Account Info">
</form>
</body>
</html>
This is what the module look like (on Enjin.com)
This is what I get when clicking the button
I did try replacing '_self' with '_blank' or parent and all the other options I could find but none of them gave me a different result :S
Could it be caused by the Enjin system itself ?
Do not use target. And replace the action as
action=""
This will ensure that you are calling the same page. Write the PHP code there itself.
Hope that help!
I am new to PHP. I have the following code and i seriously would like to have the result posted as a tweet via its API. Can anybody provide an example code how would i be able to achieve that result? I think the twitter API script should go after the submit button or so. Also when i created twitter application for this, they asked me for a url but how can i provide it? Since i am using xampp server to run PHP scripts on port number 9999. So would entering localhost:9999 in the url work? Please and thanks...
<html>
<body>
<center>
<form action="abc.php" method="POST">
<textarea rows="5" cols="50" name="typehere"></textarea><br/>
<br/>
<input type="submit" class="button" value="tweet this">
<input type="reset" class="button" value="Clear">
</from>
<?php
error_reporting(0);
$tweet = $_POST["typehere"];
echo "The following tweet has been tweeted.";
echo $tweet;
?>
</div>
</center>
</body>
</html>
Try using the API "twitter-php"
This is the official website with a tutorial
https://code.google.com/p/twitter-php/
You need more than "text message" : the username and the password
Well using the Twitter API is a bit more complicated than that.
You can use Twitter's REST Api, who works like a charm. You'll need to authenticate the user before posting, and some other things.
The complete and easy documentation is there : https://dev.twitter.com/docs/api/1.1/post/statuses/update
I am a very new to web programming and perhaps this questions might seem to obvious. I have a form on the website and a button. When the button is pressed I want to call external program (Linux executable) which is located on the server, and pass all the text data from the filled form on the page to that program as arguments, and then get the output back to user. For ex: (./myprogram username userjob ...).
How can this be implemented? What language should I use? Javascript, PHP, Python?
Thank you
You can execute the program with the system call and add the arguments posted by the user to the end of it. It would look something like this:
$theResults = system(escapeshellcmd('./myProgram '.$_REQUEST['arguments']));
echo $theResult;
A full working example would be something like this:
<?php
if(!empty($_REQUEST['arguments'])){
$results = system(escapeshellcmd('./myProgram '.$_REQUEST['arguments']));
}
?>
<html>
<head>
<title></title>
</head>
<body>
<?php
if(!empty($results)){
echo $results;
}
?>
<form method="post" action="">
Your Arguments: <input type="text" name="arguments" value="" /><input type="submit" name="Submit" value="Submit" />
</form>
</body>
</html>
You can simply use php for that:
<?php exec("./yourscript.sh");