My goal is to get the prices from this site: http://ift.tt/1wP9mvM.
There is a price field on the site that is edited once a user selects a certain option
Option code:
<form action="10530943.html" method="post" class="field">
<fieldset>
<legend>Hoeveelheid</legend>
<label for="opts-7" class="">Hoeveelheid</label>
<select name="option" id="opts-7">
<option value="5859" selected>1 kg</option>
<option value="5913">2.5 kg</option>
<option value="5935">5 kg</option>
</select>
<input type="hidden" name="variation" value="7"/>
</fieldset>
</form>
This is the area where the price is updated once a selection box has been chosen:
<h2 class="price">
<span itemprop="price">€15,99</span>
</h2>
Im using cURL to post the form to the aforementioned URL with this PHP code:
$URL = "http://ift.tt/1wP9mvM";
$c = curl_init();
$agent = 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0';
curl_setopt($c, CURLOPT_USERAGENT, $agent);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_POST, true);
$data = array(
'option' => '5935',
'variation' => '7'
);
curl_setopt($c, CURLOPT_POSTFIELDS, $data);
$contents = curl_exec($c);
$info = curl_getinfo($c);
curl_close($c);
The website just responds as if no post was made. The first option is selected regardless of my input. How is this possible? Obviously something is wrong here. Is it because the way they handle the postdata am I missing something here?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire