Solved

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

Posted on 2011-03-24
2
937 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 38

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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Attach to file (img) a unique id 8 26
How to submit record from external php form to a Sharepoint list? 5 31
replace link with jQuery 4 12
Jquery 2 11
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn how to count occurrences of each item in an array.
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.

770 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