Hi!
I'm completely stuck with a curl issue. I'm sending post variables to a site (through array), and all is fine. Except that all the array keys that are numbers,
they do not get sent, also it shifts the values. I'll provide some debugging code for your pleasure:
if (trim(strtolower($OK['norsk_statsborger'])) == "ja") {
$nstats = "1";
} else {
$nstats = "0";
}
$variablertilaconto['norsk'] = urlencode($nstats);
$variablertilaconto['26'] = urlencode($OK['Hvor_lenge_i_landet']);
$variabletilacont is the array holding the post variables to be sent.
So, this should translate to something easy.
[norsk] => 1
[26] => 1+%E5r
The problem is, after the post with curl, the following is the result:
[norsk] => 1+%E5r
the key [26] is gone, and [norsk] has takes it's value.
//$url = "debuggingcurl.php";
//Initiering av cURL-funksjonen
$curlinit = curl_init();
// setter målet
curl_setopt($curlinit, CURLOPT_URL,$url);
curl_setopt($curlinit,CURLINFO_HEADER_OUT, true);
//Noen httpservere krever 100 continue for å fortsette med postingen, her overstyrer vi det kravet.
curl_setopt($curlinit, CURLOPT_HTTPHEADER, array('Expect:'));
// Ja takk, jeg vil gjeerne sende noen postvariabler
curl_setopt($curlinit, CURLOPT_POST, true);
// Liste over parameterene som skal sendes
curl_setopt($curlinit, CURLOPT_POSTFIELDS, $variablertilaconto);
//Nei takk, jeg vil ikke få siden tilbake igjen.
curl_setopt($curlinit, CURLOPT_NOBODY, true);
//Utføring av skjemasendingen til aconto
$result = curl_exec($curlinit);
print_r(curl_getinfo($curlinit,CURLINFO_HEADER_OUT));
//Stenge forbindelsen / fjerne funksjonen
curl_close ($curlinit);