• Resolved jcdpromo

    (@jcdpromo)


    I’m working on a contact form to API where the information is passed into a TenStreet API. The Company Name field includes an & in it. In order for the XML to validate and run, the ‘& amp ;’ or ‘& #038 ;’ need to be used, but each time I add them to the XML, the form automatically changes them back to an &. In order to authorize the data to post to the API, the data needs to match.

    Right now, the & which is automatically replaced escapes the XML and when removing it, the data won’t authorize with TenStreet’s API.

    Assistance to get this working is appreciated!

    Thanks!

    • This topic was modified 6 years, 8 months ago by jcdpromo. Reason: (code didn't show originally)
    • This topic was modified 6 years, 8 months ago by jcdpromo.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Qube One ltd

    (@querysolutions)

    You can use the cf7api_create_record hook to fix the record as you wish

    add_filter( 'cf7api_create_record' , 'fix_encoding_or_something_else' , 10 , 5 );
    
    function fix_encoding_or_something_else( $record , $submited_data , $qs_cf7_data_map , $type , $template ){
       //manipulate the record as you see fit ($record)
    
       //dont forget to return the $record
       return $record;
    }
    • This reply was modified 6 years, 7 months ago by Qube One ltd.
    Ray

    (@raymondolah)

    I have what I think to be a similar issue. I need to send and API key that contains “%” and a username that contains “@”. These characters are being encoded and received by the remote server as “%25” in replace of “%” and “%40” in replace of “@”. How can I prevent the encoding with the above filter?

    Ray

    (@raymondolah)

    I tried this:

    function fix_encoding_or_something_else( $record , $submited_data , $qs_cf7_data_map , $type , $template ){
       //manipulate the record as you see fit ($record)
       //$record = urldecode($record);
    	$urldecode = $record['url'];
    	$urldecode = urldecode($urldecode); 
    	$record['url'] = $urldecode;
       //dont forget to return the $record
       return $record;
    }

    but the url is still encoding everything

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Special characters reverting from code’ is closed to new replies.