?
Solved

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

Posted on 2011-03-24
2
Medium Priority
?
1,024 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 39

Accepted Solution

by:
Aaron Tomosky earned 1000 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

WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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 and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

800 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