Hi guys,
I want to post a form through Curl. But I am getting some errors.
See [url]http://stage.sigmatec.com.pk/schoolfocus/kodak.html
This is a Form that post data to a URL. In result You will see some XML output.
I am trying to post same data using Curl but getting Page not Found error. Why is this? See my code below.
[code=php]$url = “https://secure.xmi.stagep.kodakgallery.com/servlet/XMIDispatchServlet/servlet/XMIDispatchServlet/”;
$xml_string='<?xml version=”1.0″ encoding=”UTF-8″?>
<partner_login action=”ofoto_login” version=”3.0″>
<sourceid>’.$this->source_id.'</sourceid>
<userid>’.$this->user_name.'</userid>
<password>’.$this->user_password.'</password>
</partner_login>’;
$post_data = “ofoto_xml=” . $xml_string;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$headers[] = “Content-Type: multipart/form-data”;
$headers[] = “Content-Length: ” . strlen($post_data);
$headers[] = “User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15”;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$data = curl_exec($ch);
curl_close($ch);
echo($data);
Can you help in finding out, what’s wrong in code???