Page 1 of 1

Using PHP cURL To Click Button

Posted: Mon Aug 31, 2009 1:54 pm
by lihman
I need php cURL to click a button repeatedly but the button has nothing to do with a form, it is all javascript.

Code: Select all

 
<script type="text/javascript">
function set_opacity(id, opacity) {
  element = document.getElementById(id)
  if (/MSIE/i.test(navigator.userAgent)) { element.style.filter='alpha(opacity='+opacity+')'; }
  else { element.style.opacity = opacity/100; }
  }
</script>
 
<table cellspacing="0" width="100%">
  <tr>
    <td class="center">
     
      <h4 class="strong">
        1 / 375 clicked today
      </h4>
 
     
        <p>
          <script type="text/javascript">
//<![CDATA[
recruiter_clicks = 1
//]]>
</script><a href="/recruiter/recruit/28cs5n4qu339k" id="recruit_link" onclick="return(submit_link_as_post_with_opacity(this, 'recruit_image'))"><img alt="" class="btn button_recruit" id="recruit_image" src="/A.gif?1221518016" /></a><script type="text/javascript">
//<![CDATA[
 
      link = document.getElementById('recruit_link');
      link_href = link.href;
      link.href = "#";
      set_opacity('recruit_image', 50);
     
      setTimeout("link = document.getElementById('recruit_link'); link.href = '" + link_href + "'; recruiter_clicks = 0; set_opacity('recruit_image', 100)", 2000);
   
//]]>
</script>
 
        </p>
 
According to TamperData, the POSTDATA for every click is:

Code: Select all

 
POSTDATA=Content-Type: application/x-www-form-urlencoded
Content-Length: 0
 
ALSO:
The text after /recruiter/recruit/ always changes. For example, in the code above it is /recruiter/recruit/28cs5n4qu339k but that is not always the case.

Re: Using PHP cURL To Click Button

Posted: Fri Aug 10, 2012 1:51 pm
by tr0gd0rr
Instead of PHP you can use CasperJS which will run a full V8-based browser on the server. Example usage (JavaScript):

Code: Select all

casper.start(url, function () {
	casper.click('#recruit_link');
});