SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru hifigrafix's Avatar
    Join Date
    Oct 2005
    Location
    Nashville, TN
    Posts
    628
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem w/ CURL POST

    I have a simple payment processing script which has worked for 2 years but all of a sudden quit. I suspect something is wrong with my CC provider but wanted to cover my bases.

    A query string of values is sent VIA curl to an Authorize.net processor.

    PHP Code:
    ob_start();

            
    // setup curl
                
    $ch curl_init ($url);
            
    // set curl to use verbose output
                
    curl_setopt ($chCURLOPT_VERBOSE1);
            
    // set curl to use HTTP POST
                
    curl_setopt ($chCURLOPT_POST1);
            
    // set POST output
                
    curl_setopt ($chCURLOPT_POSTFIELDS$query);
            
    //execute curl and return result to STDOUT
                
    curl_exec ($ch);
            
    //close curl connection
                
    curl_close ($ch);

        
    // set variable eq to output buffer
        
    $process_result ob_get_contents();
        
        
    // close and clean output buffer
        
    ob_end_clean();
        
        
    $clean_data str_replace("\n","&",trim(str_replace("endofdata"""trim($process_result)))); 
    Does this CURL connection look ok? I'm getting nothing back from the transaction. $process_result is simply empty.

    Thank You

  2. #2
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    67 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by hifigrafix View Post
    I have a simple payment processing script which has worked for 2 years but all of a sudden quit. I suspect something is wrong with my CC provider but wanted to cover my bases.

    A query string of values is sent VIA curl to an Authorize.net processor.

    PHP Code:
    ob_start();

            
    // setup curl
                
    $ch curl_init ($url);
            
    // set curl to use verbose output
                
    curl_setopt ($chCURLOPT_VERBOSE1);
            
    // set curl to use HTTP POST
                
    curl_setopt ($chCURLOPT_POST1);
            
    // set POST output
                
    curl_setopt ($chCURLOPT_POSTFIELDS$query);
            
    //execute curl and return result to STDOUT
                
    curl_exec ($ch);
            
    //close curl connection
                
    curl_close ($ch);

        
    // set variable eq to output buffer
        
    $process_result ob_get_contents();
        
        
    // close and clean output buffer
        
    ob_end_clean();
        
        
    $clean_data str_replace("\n","&",trim(str_replace("endofdata"""trim($process_result)))); 
    Does this CURL connection look ok? I'm getting nothing back from the transaction. $process_result is simply empty.

    Thank You
    I'd suspect if anything is wrong on your end, it lies within $query.


Bookmarks

Posting Permissions

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