Developer Forum [ All Topics | New Topic ]

Thread: Not able to upload the csv file to the rapnet through our application by php code

 =====================================================================      
         $auth_url = "https://technet.rapaport.com/HTTP/Authenticate.aspx";
         $post_string = "username=".$userId."&password=".$password;
   
    //create HTTP POST request with curl:
    $request = curl_init($auth_url); // initiate curl object
    curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
    curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
    curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data
    curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response.
    $auth_ticket = curl_exec($request); // execute curl post and store results in $auth_ticket
   
   
    $http_status = curl_getinfo($request, CURLINFO_HTTP_CODE);
    $message = $http_status;
   
    curl_close ($request);
   
   
    if($http_status==200)
    {
          $feed_url="https://technet.rapaport.com/HTTP/Upload/Upload.aspx?Method=file";
           $post_data = array(
                "file"=>"@RAPNET.csv",
                "ReplaceAll"=>false,
                "ticket"=>$auth_ticket
            );
       
           //create HTTP GET request with curl
            $request = curl_init($feed_url); // initiate curl object
            curl_setopt($request, CURLOPT_HEADER, 0);
            curl_setopt($request, CURLOPT_VERBOSE, 0);
            curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($request, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
            curl_setopt($request, CURLOPT_POST, true);
            curl_setopt($request, CURLOPT_POSTFIELDS, $post_data);
            curl_exec($request);
       
        $http_status = curl_getinfo($request);
        curl_close ($request); // close curl object
    }

==========================================================================

This is the response by curl_getinfo($request); in our code showing it uploaded but did not get any updation on the rapnet listing.

Array
(
    [url] => https://technet.rapaport.com/HTTP/Upload/Upload.aspx?Method=file
    [content_type] => text/html
    [http_code] => 200
    [header_size] => 318
    [request_size] => 264
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.297554
    [namelookup_time] => 0.224455
    [connect_time] => 0.224534
    [pretransfer_time] => 0.249105
    [size_upload] => 4135
    [size_download] => 3
    [speed_download] => 10
    [speed_upload] => 13896
    [download_content_length] => -1
    [upload_content_length] => 4135
    [starttransfer_time] => 0.252714
    [redirect_time] => 0
    [certinfo] => Array
        (
        )

    [redirect_url] => 
)




//----------------------------
Any help will be appreciable. thank you


>> add a comment
narain singh
12/28/2012 07:24


0 Replies: