I am trying to create a PHP or Perl script which will POST (or GET) contents of the Google Login page with the username and password and return Google notifications, but I am confused at what method call Google is using. I though the method call was required but I guess I was wrong
<input id="Email" name="Email" placeholder="Enter your email" type="email" value="" spellcheck="false" autofocus="">
(Shouldn't it also have a method for GET or POST)
The page I'm trying to make the calls on is located on https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=https://mail.google.com/mail/&ss=1&scc=1<mpl=default<mplcache=2&emr=1&osid=1#identifier
Related
I am trying to integrate HubSpot into a custom form and my PHP knowledge is limited. So any help would be very much appreciated.
When submitting my form i am getting a log of 204. When I go to my form submissions I can see an entry but no data is being carried across.
Bellow is my form code.
HTML:
<input id="first_name" class="hs-input" name="first_name" type="text" placeholder="First Name" autocomplete="given-name" value="" required>
<input id="lastname" class="hs-input" name="last_name" type="text" placeholder="Last Name" autocomplete="family-name" value="" required>
<input id="phonenumber" class="hs-input" name="phone_number" type="number" placeholder="Phone Number" value="" required>
<input value="Submit" typeI"submit">
And i am using the PHP script from this link:
https://developers.hubspot.com/docs/methods/forms/submit_form
Thanks
A 204 status code is actually a success status code;
The 204 (No Content) status code indicates that the server has successfully fulfilled the request and that there is no additional content to send in the response payload body.
HTTP Protocol definition
So basically it tells you; "Hey, I'm all good. Data received and processed". You don't need additional information do you? Only when it fails you would want to know why it fails.
When you copied the script form the Hubspot API docs, did you notice this line?
//Need to populate these variable with values from the form.
The variables right below that line ($firstname, $lastname, etc) don't actually exist yet. You will have to add something like this before that line;
$firstname = $_POST['first_name'];
$lastname = $_POST['last_name'];
// etc.
I have a form on my site that I would like users to be able to submit without the page reloading. I found this answer which solved that part of it for me, but now I am trying to figure out how I would add success/error messaging to the form upon submit.
Here is my form code:
<iframe name="submit" style="display:none;"></iframe>
<form method="post" action="submit.php" target="submit">
<input type="text" name="firstname" placeholder="First name" />
<input type="text" name="lastname" placeholder="Last name" />
<input type="text" name="email" placeholder="Email address" />
<input type="submit" name="submit" value="" />
</form>
How can I determine whether the form was submitted successfully or not and display a success or error message based on the result? Also open to other suggestions for submitting the form without the page reloading.
To clarify what other commenters are already saying or have said:
The source-code in your original post consists only of a vanilla "form submit," which will be dutifully carried out by the browser just as things were done when HTTP was first invented: "the data will be submitted to the host, and whatever the host returns will be displayed as the 'next page.'" In this scenario, the role of the web-browser is totally passive.
Very commonly today, a technique called "AJAX" is used: instead of just "submitting the form" when a button is clicked, the submit-button causes a JavaScript subroutine to be run, and it (using an "Asynchronous HTTP Request" = "XHR") both submits the data to the host and intercepts the host's response. The role of (the JavaScript now being executed by) the web-browser is now active.
The host, in turn, now ordinarily does not return "displayable HTTP text." Knowing that it's being talked-to by another computer program, it instead sends that program something that can be very-easily consumed. The host typically sends "a data structure," which is ordinarily formatted in a format called "JSON."
... and, today, there are legions of great JavaScript libraries that can "make this a piece o' cake." (JQuery is only the most-popular one.)
Therefore, "surf over to some of these web sites, and take a look at their examples." (They not only supply the working demonstrations, for your amusement and amazement, but they show you on-the-spot exactly how it's done.)
I am using the Wufoo form api to POST to a form on my account, But despite following the documentation I run into this error:
This form can't accept new entries. Please inform the owner of the form so they can contact Wufoo Support
So far the following requirements have been met:
Using correct subdomain and form identifier
Using version 3
Response = JSON
Using Basic Authentication used with API Key and password
Sending the parameters as an array "FieldID" => "Value"
Form set to public
Password protected my form
Yet I still get this error, is there anything else I / the documentation is missing?
I was very frustrated by this issue too.. it seems that that response is given anytime you give the API form ID's it's not expecting (like Field4, Field4-1, Field4-2) instead of simply combining them into one Field (at least for me)
I had a phone number field that wuFoo split into 3 parameters:
<li id="foli4" class="phone notranslate">
<label class="desc" id="title4" for="Field4">
Phone Number
</label>
<span>
<input id="Field4" name="Field4" type="tel" class="field text" value="" size="3" maxlength="3" tabindex="4"/>
<label for="Field4">###</label>
</span>
<span class="symbol">-</span>
<span>
<input id="Field4-1" name="Field4-1" type="tel" class="field text" value="" size="3" maxlength="3" tabindex="5" />
<label for="Field4-1">###</label>
</span>
<span class="symbol">-</span>
<span>
<input id="Field4-2" name="Field4-2" type="tel" class="field text" value="" size="4" maxlength="4" tabindex="6" />
<label for="Field4-2">####</label>
</span>
</li>
In PHP, I decomposed this via http_build_query($_POST) into:
Field4=555&Field4-1=555&Field4-2=5555 and sent it via the boilerplate code they provide over cURL https://wufoo.github.io/docs/?shell#submit-entry.
Sending this returned the response:
{"Success":0,"ErrorText":"This form can't accept new entries. Please inform the owner of the form so they can contact Wufoo Support.","FieldErrors":[]}
When I sent this However:
Field4=5555555555 in my post body, the form submission succeeds!
It appears that even though WuFoo splits parts of its form into several components, it's expecting the response to be concatenated together, otherwise it freaks out.
Hope this helps all of you out there struggling with the WuFoo API!
I am attemping to create a PHP login system using MySQLi.
However I have created an HTML Form:
<form action="register_manager.php" method="post">
<p>Please fill all fields!</p>
<input type="text" name="username" value="<?PHP print $getuser; ?>" maxlength="15" /><br />
<input type="password" name="password" placeholder="Password" maxlength="15" />
<input type="password" name="confirmpassword" placeholder="Confirm Password" /><br />
<input type="text" name="email" placeholder="E-Mail Address" />
<p style="margin: 0; padding: 0;">
(Use a vaid a valid E-Mail Address for activation!)
</p>
<p>
Already got an account?
</p>
<input type="submit" name="regsubmit" value="Register"/><br />
<?PHP echo '<p>'.$errormsg.'</p>'; ?>
</form>
Once I click submit, it redirects me to the registration_manager.php page, which is not what I want it to do. I am new to PHP so I am not aware on why it is doing this, instead of registering the user.
This is the register_manager.php file:
http://pastebin.com/cvbA6L6P
The action specified in your form is register_manager.php so whenever you hit the submit button you will get redirected there. Also, in the link you provided of the source code of register_manager.php, you're generating error messages, depending on the case, but never printing them on the page so the user can see what is wrong, unless of course the html form you provided is included in the register_manager.php. Finally, when testing make sure you fill all the requirements set by the if statements in you register_manager.php file, i.e. pass all wanted fields (username, email (which must be longer than 7 chars, containing the '#' and '.' characters), password, password confirmation). Hope this solves your question!
What you are describing is normal. The browser will send a POST request to the URL defined as action. So you need to render the form there as well. You can either abstract the form out and reuse it in both files or do the initial form rendering and the processing in one file by checking if $_POST['regsubmit'] is set (if it is not set you are rendering the form initially).
Submit button will activate the request of the webpage specified in the attribute action, passing the information inside the form by the method selected. In your example, the information is passed to register_manager.php using POST method.
To retrieve the information passed, you could use the arrays $_POST and $_GET depending the method used. In your example:
<?php
print $_POST['password'];
print $_POST['confirmpassword'];
print $_POST['email'];
?>
I want to implement a custom login module inside wordpress. In the home page, I have this form where the users could register and another form where the users can login to the website.
Is it a better Idea to write custom code inside wordpress to accomplish my goal?
What other alternative do you suggest to it ?
you might be interested in a blog post about building a customized login form, I recently wrote.
It describes how to include a custom login form in any template, how to change the custom output and how to handle redirects after successfull/failed/empty login.
The WordPress-API functions/hooks involved are:
wp_login_form, authenticate and wp_login_failed
Nothing is wrong with writing custom code if you need something specific to happen when a user logs in. Other than writing custom code also is that you could just get an already built plugin!
You can use this code to create a WordPress login form on any page.
<div id="login">
<form name="loginform" id="loginform" action="YOUR_WORDPRESS_FOLDER/wp-login.php" method="post">
<label>Username:<input type="text" name="log" id="log" value="" size="20" tabindex="1" /></label>
<label>Password: <input type="password" name="pwd" id="pwd" value="" size="20" tabindex="2" /></label>
<label class="submit">
<input type="submit" name="submit" id="submit" value="Login ยป" tabindex="3" />
<input type="hidden" name="redirect_to" value="wp-admin/" />
</form>
</div>
Writing custom code for Wordpress is a very common thing. It almost what's expected. Otherwise, you also have many themes and plugins where other people have written code you can use in your own Wordpress site.
Wordpress also has a internal way to Register new users:
If you enable this option under Settings > General, then your login page would have an option to register new users.
Otherwise, if you want to write your own login code, you can start reading around the WP docs, for example in the internal function
register_new_user.
Unless you are creating something complex or special, you can stick to the built-in registration, and also customize with with HTML & CSS as you wish.