www.webdeveloper.com
Results 1 to 3 of 3

Thread: curl problem

  1. #1
    Join Date
    Nov 2006
    Posts
    104

    Lightbulb curl problem

    Hi guys,

    I want to post a form through Curl. But I am getting some errors.
    See 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.
    PHP Code:
    $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???

  2. #2
    Join Date
    Sep 2008
    Location
    Mexico
    Posts
    786
    Does your server support XForms????
    ...but stupidity is terminal.

  3. #3
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,755

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles