Hello, I humbly ask for some help here (I've spent over 3 weeks trying to figure this out on my own), I am new at coding and need a little hand-holding. Here is my question, please:
I've been provided a username and password to post form data to a website.
This script does not work (reason listed below):
[FONT=Arial]<?php
$ch = curl_init('http://www.website.com/index.php?username=myself&password=password');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('inputname1'=>"hammer",'inputname2'=>'nail'));
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible, MSIE 10, Windows NT 6.2');
$data = curl_exec($ch);
curl_close($ch);
var_dump($data);
?>[/FONT]
Reason it doesn't work: the website's sourcecode shows a "hidden input" field with a random number generated with each visit
[FONT=Arial]<input type="hidden" name="controlNumber" value="39282928">[/FONT]
May I please ask your help to modify my code to first "get" that random number, and then "post" it along with the other post variables?
Note: the website does not require me to have javascript turned on, and does not require me to allow cookies, either.
Thank you.