Solved

PHP Curl, To Fill in a input field and click a button.

Posted on 2011-03-24
2
954 Views
Last Modified: 2012-08-14
Can anybody tell me if the following is possible:

Can I use PHP curl to target a input field, fill in some text then execute a button click or JavaScript function within the loaded page?

If so... How?

This is not a regular form with POST methods....

Form that I'm trying to process remotely
<div class="IngeniMailSubscribeContainer" id="IngeniMailSubscribeContainer_430321" align="center">
   <div style="margin-bottom: 8px;">
	 <span class="subhead">Your email:</span>
	 <input class="IngeniMailSubscribeEmailInput" type="text" size="20" id="IngeniMailSubscribeEmailInput_430321" value="" /> 
   </div>
   <input class="IngeniMailSubscribeButton" type="button" value="Subscribe" onclick="MailSubValidateSubmit_430321();" />
   <div id="MailSubscribeError_430321" align="left" class="normalred"></div>

</div>

<script type="text/javascript">
function MailSubValidateSubmit_430321()
{
    
	document.getElementById('MailSubscribeError_430321').innerHTML = '';
	var inputId = 'IngeniMailSubscribeEmailInput_430321';

	var Input = document.getElementById(inputId);
	var val = '' + Input.value;
	var rx = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/ig;
	var matches = rx.exec(val);

	if (matches != null && val == matches[0]) {
		MailSubscribe.MailSubscribeClick(430321,240570);
	}
	else {
		document.getElementById('MailSubscribeError_430321').innerHTML = 'Invalid email';
	}
}

function MailSubUnsubscribe(email)
{
	var Container = document.getElementById('IngeniMailSubscribeContainer_430321');
	Container.innerHTML = "<input id='IngeniMailSubscribeEmailInput_430321' type='hidden' value='" + email + "'/>";
	MailSubscribe.MailSubscribeClick(430321,240570);
}
</script>

Open in new window

0
Comment
Question by:Cybervanes
2 Comments
 
LVL 39

Accepted Solution

by:
Aaron Tomosky earned 500 total points
ID: 35211691
Curl does post and get. It doesn't do JavaScript clicks.
0
 
LVL 2

Author Closing Comment

by:Cybervanes
ID: 35890995
answer would work but dint hit on the specifics of the question
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question