I searched and searched how to create a php script to select (2) specific dynamic drop down fields when accessing a url, but when I run my code below, it shows the url, but the two drop downs are not selected.
The options and their corresponding values look like this:
The corresponding code I'm using:
$ch = curl_init();
$data_fields = array('year' => '2014',
'makes' => '200002038'
);
curl_setopt($ch, CURLOPT_URL,'http://thesitesurl.com/location-to-file-that-form-exists-on-here');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17');
curl_setopt ($ch, CURLOPT_POST, TRUE);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data_fields);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close ($ch);
The output when I run the code currently is - it displays the contents of the CURLOPT_URL
on the page, but none of the form options are selected.
Any thoughts?
Thank you!
<input
also you need to post the form to<form action=url
– DevZer0 Jun 19 '13 at 21:17