Link to home
Start Free TrialLog in
Avatar of kenitech
kenitech

asked on

Constant Contact API using php

I have 2 different Interest Categories defined in Constant Contact and would like to use the API to post the information to Constant Contact's API_AddSiteVisitor.jsp script. The provided documentation is pretty vague.

I am trying to post the form data using the following method they suggest(note, this is not the whole script):

--------

$host = "ccprod.roving.com";
$uri = "roving/wdk/API_AddSiteVisitor.jsp";
$username = "foo";
$password = "bar";

$email = urlencode(strip_tags($_POST['email']));
$category = urlencode(strip_tags('My Category'));

$data = 'loginName=' . $username ;
$data .= '&loginPassword=' . $password ;
$data .= '&ea=' . $email ;


<form method='POST' action='http://$host/$uri?$data' name='form' onSubmit='return checkbae()'>

-----------

When the form is posted my browser prompts me to save the  .jsp file

in their original example file the Form action looked like this which made no sense to me because there is no parameter 'newsletter' defined anywhere else in the script:

<form method='POST' action='index.php?form=newsletter' name='form' onSubmit='return checkbae()'>

-------------

If I paste the url I am trying to post into the browser the email gets added.

http://ccprod.roving.comroving/wdk/API_AddSiteVisitor.jsp?loginName=foo&loginPassword=bar&ea=myemail@domain.com&ic=My+List

-------------

I'd like someone who has actually dealt with this particular application and Constant Contact to answer this for me.

Thanks!
Avatar of kenitech
kenitech

ASKER

i think part of the problem is related to the libcurl call in the script. I might not have this package installed on my server.....
Did you try to save this .jsp file that your browser prompts you, and see, maybe there is some error message that may give you an idea?
I seem to have Resolved this issue. The problem was that the server did not have the php_curl.dll properly installed.
btw, this is on php for WinNT

php.ini
uncomment the following line
;extension=php_curl.dll

Then according to the info here
http://us3.php.net/manual/en/install.windows.extensions.php

After restarting Apache I received some errors indicating that it could not find the following dlls:
libeay32.dll
ssleay32.dll

I had these dll's  present in my php directory. Apparently this wasn't cutting it so I found out that I had to copy the ones that were packaged with php to my win/system32 directory. Windows would not let me overwite these older dlls while operating so I rebooted in safe mode (F8) with command prompt and manually overwrote them.

Then I restarted apache and the script now works.

I also tested this on a Unix box which already had everything configured correctly but I needed it to work for this one.

Question Resolved.
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial