I'm trying to use a standard form in a facebook application
the form code look like this
<form method="POST" action="/bristolhouse/">
<input type="hidden" name="kind" value="admin" />
{$admin_message} <br />
<input type="submit" value="Add" />
</form>
The error I'm getting is
API Error Code: 100
API Error Description: Invalid parameter
Error Message: Requires valid redirect URI.
I've seen this error before when I didn't have the correct values in my config file for the redirect URI. I'm not sure if i need to include auth_tokens or how I should be including the URI. I can't find any examples on the net.
Edit: For example the link I'm getting to is https://www.facebook.com/dialog/oauth?client_id=282683341837527&redirect_uri=
so I'm getting to the right place just not passing the correct parameter
Suggestion, try changing action="/bristolhouse/" to action="bristolhouse"
ie removing the slashes
Related
I have a form on my web page and on button click i try go post some variables in one of which i hold in its value a http://somelink.com and when the post occurs i get server error, if i take off http:// from the value of the text field everything goes ok.Has anyone any idea what should be this issue? Thank you in
here is part of my form
<form method="post" action="./edit.php" name="one" id="one">
Name: <input type="text" name="BanName" id="BanName" value=""/><br/>
Link: <input type="text" name="Link" id="Link" value=""/><br/>
<input type="button" id="but" name="but" value="Submit" onClick="document.one.submit();" />
</form>
here is what i get
Forbidden
You don't have permission to access /b/admin/edit.php on this server.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
PHP Version 5.3.27
After i get the variable with $_POST["Link"] i call this function
function generateIframeBanner($src){
if(!preg_match('/^http:\/\//',$src)){
$src='http://'.$src;
}
$html='<iframe src="'.$src.'" frameborder="0" scrolling="no"></iframe>';
return $html;
}
I have a very strange strange problem in my form submissions in a plugin I'm developing.
Both take URL's as a parameter, but in one of them, I can submit www.example.com and in the other, o cannot submit the exact same link.
As result, when I try to submit, I get the following error:
You don't have permission to access /wp-admin/admin.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
What could this be?
This is really freaking me out.
if(isset($_POST['indot_under_submit'])){
//do stuff
}
<form name='slug_settings_form' id='slug_settings_form' method='post' action="<?php echo $_SERVER['REQUEST_URI']; ?>">
<label for="slug_social_googleplus">Google Plus</label>
<input type="text" name="slug_social_googleplus" value="<?php echo $option['social']['googleplus']; ?>" size="60"/>
<label for="slug_social_tumblr">Tumblr</label>
<input type="text" name="slug_social_tumblr" value="<?php echo $option['social']['tumblr']; ?>" size="60"/>
<input type="submit" class='button-primary' name="slug_under_submit" id="slug_under_submit" value="Save" />
</form>
I've tried to see if it was a permlinks problem, it is not.
I tried to see if it was some kind of post limit, and it is not.
I've also tried allot of different things I cannot recall, and searched allot.
This error does not make sense to me.
What is this for site options or user settings?
If it is for site options it should be submitted to the admin options.php
I have a .php file which I will be using to submit requests to a certain API. This API will return information regarding certain domain URLs, such as the domains age, PageRank, etc.
The part of the PHP file which is responsible for feeding the API call URL with the domain names I'm interested in looks as follows:
$batchedDomains = array('www.example.com', 'www.cnn.com', 'www.apple.com');
What I would like to do is feed this array information through a very simple HTML form. My current HTML for the form looks as follows:
<form name="myform" action="apitest.php" method="POST">
<input type="hidden" name="check_submit" value="1" />
URL List:<br />
<textarea name="urls" rows="20" cols="60">Enter URLs</textarea><br />
<input type="submit" />
</form>
Here is what I would like to see happen: whenever I enter a list of domain URLs into the HTML form (one domain per line), I would like the $batchedDomains array to be populated with those values.
Can anyone help me out with this? Or if you have a suggestion for a different solution I'm of course willing to hear it out.
I do not want this information printed anywhere, as it will simply be used by the php script to call the API and display the results.
Thank you.
$urls = array_filter(explode(PHP_EOL, $_POST['urls']), 'parse_url');
Or pass a custom callback with filter_var() + FILTER_VALIDATE_URL for stricter checks
If you're just entering one per line, you can split the textarea string by newlines, see https://stackoverflow.com/a/1483501/2213444.
<?php
// has no error checking, you'll want to check that $_POST['urls'] exists
$textarea = explode("\r\n", $_POST['urls']);
print_r($textarea);
?>
<form action="" method="post">
<textarea name='urls' rows='20' cols='60'>
</textarea>
<input type="submit">
</form>
Working Example
I am writing a simple application that lists all the Notes via the Evernote API. I have successfully authenticated and retrieved a list of Notes.
Now I am trying to get Note thumbnails via the Evernote API. I have read their [documentation here][1]. I tried a POST request, but for some reason it's not working. Obviously, I am doing something wrong. Can you please give me a quick, simple, example?
Example Code:
<form method="post" action="https://www.evernote.com/shard/s226/thm/note/64c08998-0bd3-4964-83fd-73a3baaf53cd.jpg?size=40">
<input type="submit" value="View Thumbnail">
</form>
I just set the form method to POST and action to Note Thumbnail. The note thumbnail works when you log in yourself into the Evernote website, but otherwise, it just says access denied. I am new to Evernote API, so I tried the above code just to see if that works or not.
Correct Example Code:
<form method="post" action="https://www.evernote.com/shard/s226/thm/note/64c08998-0bd3-4964-83fd-73a3baaf53cd.jpg?size=40">
<input type="hidden" name="auth" value="{authentication token}">
<input type="submit" value="View Thumbnail">
</form>
You will need to include the authentication token in the request.
how can i pass parameters from an html page(map.html) to a php(createxml.php) without having to open the php page? Im incorporating googlemaps in html page(map.html) so i want the users to enter data on a form on the html page which will be sent to php(createxml.php) which in turn will connect to mySQL DB and create an xml format of the response the html page uses this xml output to create positions on the map since it contains longitude and latitude.
I have used the following code in the heading of the php page(createxml), but it shows the contents of php file for a brief moment redirecting me to map.html
Thanks for your time, i can post all the code if needed.
<meta http-equiv="refresh" content="0;url=http://localhost/map.html/">
It's quite simple with AJAX, using jQuery you don't have to know much about it :)
So simply import the latest jQuery Library.
Then you have your form:
<form id="my_form">
<input type="text" name="param1" />
<input type="text" name="param2" />
<input type="hidden" name="action" value="do_stuff" />
<input type="submit" value="Submit" />
</form>
and somewhere beneath that, you just paste this tiny javascript-function, which handles the submit of the form:
<script>
$('#my_form').submit(function(){
var post_params = $('#my_form').serialize();
$('#waiting').show();
$.post('the_page_you_are_on.php', post_params, function(data) {
$('#waiting').hide();
return false;
})
});
</script>
(The element (div, p...) with the id "waiting" could e.g. contain one of those fancy ajax loading images, but is not neccessary! :) If you want one to be shown, find one via google, set it as the background image of the #waiting-element and set its display to none (CSS)).
The function itself just calls the page you're on and then you've got the form variables in your post-array, so the top of your page could look something like this:
<?php
if(isset($_POST['action'])) {
switch($_POST['action']) {
case 'do_stuff' :
$param1 = $_POST['param1'];
$param2 = $_POST['param2'];
//do some DB-stuff etc.
break;
}
}
?>
I hope that helps!
It's a terrible idea, but because you don't want to use AJAX you could put the PHP in a frame and reload just that portion. Again, awful idea, but the closest you're going to get without using AJAX.
On a useful note though, AJAX is literally just one function in javascript. It's not hard at all to learn.
If you are just trying to pass parameters to a PHP page from the web browser, there are other ways to do it beyond 'Ajax'. Take a look at this page and view the source code (be sure to view the source of the included javascript file: http://hazlo.co/showlist.php?s=chrome&i=4e289d078b0f76b750000627&n=TODO
It uses an extremely basic method of changing the src of an image element, but passes information to the web server (PHP page) in the querystring of the image request. In this example I actually care about the results, which are represented as an image, but it sounds like you are just trying to pass data to the server, so you can return a 1 pixel image if you like. BTW, don't be fooled by the URL that is being used, a server rule is telling apache to process a specific PHP file when check it,GIF is requested.
You should play with it and use firebug or chrome's built in debugger to watch the requests that are being sent to the server.
You can't get any results from a PHP-script if you don't request it and process the output. If you dont't want to leave the current page, you have to use AJAX!
"but it shows the contents of php file for a brief moment" The reason is, that your browser first needs to load the entire page, then start the META-redirect. You don't need a redirect to load data from the server, but if you really want to, you should HTTP-headers for redirect.
Ok guys after hours of headache i finally found the solution! Basically i called my xmlproduce.php from inside my map.html, lemme explain so maybe will help others:
maps.html contained a googlmap API Javascript function which called my createxml.php called second.php
GDownloadUrl("second.php", function(data) )
what i did was i tweaked this call to second.php by adding some parameters in the URL like:
GDownloadUrl("second.php?strt="+ysdate+"/"+msdate+"/"+dsdate+"&end="+yedate+" /"+medate+"/"+dedate+"&id="+ide, function(data)
which is sending the parameters needed by second.php, so after that i made a small html form which called the script of googlemap api on the same file(map.html) to pass the parameters from the form to the GDownloadUrl i mentioned above, the code of the form is :
form method="get" action="">
IMEI: <input type="text" id="id" name="id" size="25" /> <br />
Start Date: <input type="text" id="ysdate" name="ysdate" size="4" value="2000" /> <input type="text" id="msdate" name="ysdate" size="1" /> <input type="text" id="dsdate" name="dsdate" size="1" /> <br/>
End Date: <input type="text" id="yedate" name="yedate" size="4" /> <input type="text" id="medate" name="ysdate" size="1" /> <input type="text" id="dedate" name="dedate" size="1" /> <br/>
<input type="button" value="submit" onClick="load()" />
</form>
afterwards i put extra constraints on the form for the values allowed.
Thanks everybody for the help, and you can always ask if somebody needs some clarification.