Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-03-24
2
Medium Priority
?
1,047 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

618 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