Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7835931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:53:16+00:00 2026-06-02T13:53:16+00:00

I get an error trying to format the following code: The code was copy-pasted

  • 0

I get an error trying to format the following code:
The code was copy-pasted from http://tareqalam.wordpress.com/2010/07/07/paypal-recurring-payment-integrated-with-codeigniter/

<?php

class callerservice extends Model {

var $API_UserName;

var $API_Password;

var $API_Signature;

var $API_Endpoint ;

var $version;

var $subject;
 var $CI;
 var $USE_PROXY;
 var $PROXY_HOST;
 var $PROXY_PORT;

function callerservice()
 {
 // Call the Model constructor
 parent::Model();

$this->CI =& get_instance();
 $this->CI->load->helper(‘url’);
 $this->CI->load->helper(‘form’);
 $this->CI->load->library(‘session’);

$this->CI->load->config(‘paypal_constants’);

$this->API_UserName = $this->CI->config->item(‘API_USERNAME’);

$this->API_Password = $this->CI->config->item(‘API_PASSWORD’);

$this->API_Signature = $this->CI->config->item(‘API_SIGNATURE’);

$this->API_Endpoint = $this->CI->config->item(‘API_ENDPOINT’);

$this->subject = $this->CI->config->item(‘SUBJECT’);

$this->version = $this->CI->config->item(‘VERSION’);

$this->USE_PROXY = $this->CI->config->item(‘USE_PROXY’);

$this->PROXY_HOST = $this->CI->config->item(‘PROXY_HOST’);

$this->PROXY_PORT = $this->CI->config->item(‘PROXY_PORT’);

}

/**
 * hash_call: Function to perform the API call to PayPal using API signature
 * @methodName is name of API  method.
 * @nvpStr is nvp string.
 * returns an associtive array containing the response from the server.
 */

function hash_call($methodName,$nvpStr)
 {
 //declaring of global variables
 //global $API_Endpoint,$version,$API_UserName,$API_Password,$API_Signature,$nvp_Header, $subject;

//setting the curl parameters.
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL,$this->API_Endpoint);
 curl_setopt($ch, CURLOPT_VERBOSE, 1);

//turning off the server and peer verification(TrustManager Concept).
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
 curl_setopt($ch, CURLOPT_POST, 1);
 //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
 //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php
 if($this->USE_PROXY)
 curl_setopt ($ch, CURLOPT_PROXY, $this->PROXY_HOST.”:”.$this->PROXY_PORT);

//check if version is included in $nvpStr else include the version.
 if(strlen(str_replace(‘VERSION=’, ”, strtoupper($nvpStr))) == strlen($nvpStr)) {
 $nvpStr = “&VERSION=” . urlencode($this->version) . $nvpStr;
 }

$nvpreq=”METHOD=”.urlencode($methodName).$nvpStr;

//setting the nvpreq as POST FIELD to curl
 curl_setopt($ch,CURLOPT_POSTFIELDS,$nvpreq);

//getting response from server
 $response = curl_exec($ch);

//convrting NVPResponse to an Associative Array
 $nvpResArray=$this->deformatNVP($response);
 $nvpReqArray=$this->deformatNVP($nvpreq);
 $ASESSION['nvpReqArray']=$nvpReqArray;

if (curl_errno($ch)) {
 // moving to display page to display curl errors
 $ASESSION['curl_error_no']=curl_errno($ch) ;
 $ASESSION['curl_error_msg']=curl_error($ch);
 print_r($ch);exit;
 //$this->redirect(‘error’);
 } else {
 //closing the curl
 curl_close($ch);
 }
 $this->CI->session->set_userdata($ASESSION);

return $nvpResArray;
 }

/** This function will take NVPString and convert it to an Associative Array and it will decode the response.
 * It is usefull to search for a particular key and displaying arrays.
 * @nvpstr is NVPString.
 * @nvpArray is Associative Array.
 */

function deformatNVP($nvpstr)
 {

$intial=0;
 $nvpArray = array();

while(strlen($nvpstr)){
 //postion of Key
 $keypos= strpos($nvpstr,’=');
 //position of value
 $valuepos = strpos($nvpstr,’&’) ? strpos($nvpstr,’&’): strlen($nvpstr);

/*getting the Key and Value values and storing in a Associative Array*/
 $keyval=substr($nvpstr,$intial,$keypos);
 $valval=substr($nvpstr,$keypos+1,$valuepos-$keypos-1);
 //decoding the respose
 $nvpArray[urldecode($keyval)] =urldecode( $valval);
 $nvpstr=substr($nvpstr,$valuepos+1,strlen($nvpstr));
 }
 return $nvpArray;
 }

}
 ?>

then create a file paypal_constants.php in config folder

<?php

class callerservice extends Model {

var $API_UserName;

var $API_Password;

var $API_Signature;

var $API_Endpoint ;

var $version;

var $subject;
 var $CI;
 var $USE_PROXY;
 var $PROXY_HOST;
 var $PROXY_PORT;

function callerservice()
 {
 // Call the Model constructor
 parent::Model();

$this->CI =& get_instance();
 $this->CI->load->helper(‘url’);
 $this->CI->load->helper(‘form’);
 $this->CI->load->library(‘session’);

$this->CI->load->config(‘paypal_constants’);

$this->API_UserName = $this->CI->config->item(‘API_USERNAME’);

$this->API_Password = $this->CI->config->item(‘API_PASSWORD’);

$this->API_Signature = $this->CI->config->item(‘API_SIGNATURE’);

$this->API_Endpoint = $this->CI->config->item(‘API_ENDPOINT’);

$this->subject = $this->CI->config->item(‘SUBJECT’);

$this->version = $this->CI->config->item(‘VERSION’);

$this->USE_PROXY = $this->CI->config->item(‘USE_PROXY’);

$this->PROXY_HOST = $this->CI->config->item(‘PROXY_HOST’);

$this->PROXY_PORT = $this->CI->config->item(‘PROXY_PORT’);

}

/**
 * hash_call: Function to perform the API call to PayPal using API signature
 * @methodName is name of API  method.
 * @nvpStr is nvp string.
 * returns an associtive array containing the response from the server.
 */

function hash_call($methodName,$nvpStr)
 {
 //declaring of global variables
 //global $API_Endpoint,$version,$API_UserName,$API_Password,$API_Signature,$nvp_Header, $subject;

//setting the curl parameters.
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL,$this->API_Endpoint);
 curl_setopt($ch, CURLOPT_VERBOSE, 1);

//turning off the server and peer verification(TrustManager Concept).
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
 curl_setopt($ch, CURLOPT_POST, 1);
 //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
 //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php
 if($this->USE_PROXY)
 curl_setopt ($ch, CURLOPT_PROXY, $this->PROXY_HOST.”:”.$this->PROXY_PORT);

//check if version is included in $nvpStr else include the version.
 if(strlen(str_replace(‘VERSION=’, ”, strtoupper($nvpStr))) == strlen($nvpStr)) {
 $nvpStr = “&VERSION=” . urlencode($this->version) . $nvpStr;
 }

$nvpreq=”METHOD=”.urlencode($methodName).$nvpStr;

//setting the nvpreq as POST FIELD to curl
 curl_setopt($ch,CURLOPT_POSTFIELDS,$nvpreq);

//getting response from server
 $response = curl_exec($ch);

//convrting NVPResponse to an Associative Array
 $nvpResArray=$this->deformatNVP($response);
 $nvpReqArray=$this->deformatNVP($nvpreq);
 $ASESSION['nvpReqArray']=$nvpReqArray;

if (curl_errno($ch)) {
 // moving to display page to display curl errors
 $ASESSION['curl_error_no']=curl_errno($ch) ;
 $ASESSION['curl_error_msg']=curl_error($ch);
 print_r($ch);exit;
 //$this->redirect(‘error’);
 } else {
 //closing the curl
 curl_close($ch);
 }
 $this->CI->session->set_userdata($ASESSION);

return $nvpResArray;
 }

/** This function will take NVPString and convert it to an Associative Array and it will decode the response.
 * It is usefull to search for a particular key and displaying arrays.
 * @nvpstr is NVPString.
 * @nvpArray is Associative Array.
 */

function deformatNVP($nvpstr)
 {

$intial=0;
 $nvpArray = array();

while(strlen($nvpstr)){
 //postion of Key
 $keypos= strpos($nvpstr,’=');
 //position of value
 $valuepos = strpos($nvpstr,’&’) ? strpos($nvpstr,’&’): strlen($nvpstr);

/*getting the Key and Value values and storing in a Associative Array*/
 $keyval=substr($nvpstr,$intial,$keypos);
 $valval=substr($nvpstr,$keypos+1,$valuepos-$keypos-1);
 //decoding the respose
 $nvpArray[urldecode($keyval)] =urldecode( $valval);
 $nvpstr=substr($nvpstr,$valuepos+1,strlen($nvpstr));
 }
 return $nvpArray;
 }

}
 ?>

The error is printed in the Error Log in Aptana,

-- Error Details --
Date: Thu Dec 08 15:32:24 CET 2011
Message: Error while formatting the code in your editor.Please submit a bug report through Studio's support and include the relevant code which triggered this error.
Severity: Error
Product: Aptana Studio 3 3.0.6.201110251455 (com.aptana.rcp.product)
Plugin: com.aptana.formatter.epl
Session Data:
eclipse.buildId=unknown
java.version=1.6.0_29
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86, WS=cocoa, NL=en_US
Framework arguments:  -keyring /Users/alex/.eclipse_keyring -showlocation
Command-line arguments:  -os macosx -ws cocoa -arch x86 -keyring /Users/alex/.eclipse_keyring -consoleLog -showlocation


Error
Thu Dec 08 15:32:24 CET 2011
Error while formatting the code in your editor.Please submit a bug report through Studio's support and include the relevant code which triggered this error.

Am I running into an Aptana/Eclipse bug or is something else going on?

Thanks in advance,

Alex

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T13:53:17+00:00Added an answer on June 2, 2026 at 1:53 pm

    Dec 8 ’11 at 14:52:

    The problem was due to bad quote signs and apostrofs: “ ” ‘ ’ Replaced them with ” and ‘ Bad error logging though 🙂

    Eclipse: http://bugs.eclipse.org/bugs/show_bug.cgi?id=366045

    Aptana: https://jira.appcelerator.org/browse/APSTUD-4680

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get following error when trying to access Xampp from a network I've tried
I'm trying to get the following code working: string url = String.Format(@SOMEURL); string user
Why do I get following error when trying to start a ruby on rails
I am using the following gem in my rails application: http://github.com/fnando/post_commit I am trying
I get the following error 12-15 16:54:37.125: ERROR/MediaPlayer(6032): error (-2147483648, 0) when trying to
I'm recieving the following error code when trying to test run an app. Application
When exporting data to excel via COM Interop I get an error (code 0x800A03EC)
I am trying to get some errors returned in JSON format. So, I made
I get this error when trying ruby script/console Rails requires RubyGems >= . Please
I get this error when trying to link a win32 exe project. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.