PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
//
// A very simple PHP example that sends a HTTP POST to a remote site
//
$post_data = array(
'xnadfjsdp' => '*5tadfafI$',
'xnQ6adfagp' => '*5t6adsfasgVJI$',
'xmadfafD' => 'nGtvadfI-26fghgaha2r6PfafR5kYBU',
'actionType' => 'TGVh4sv',
'First Name' => 'joe',
'Last Name' => 'schmoe',
);
$ch = curl_init();
// set referer:
curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com/");
// This allows you to type google.com and not http://www.google.com
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt($ch, CURLOPT_URL,"https://crm.zoho.com/crm/WebToLeadForm");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data);
curl_exec ($ch);
curl_close ($ch);
?>
Cheers and thanks
Last edited by puma10 on Wed Aug 24, 2011 6:21 pm, edited 1 time in total.
There are some setting for dealing with connecting to a SSL site (you can tell it to try to not verifying the certificate). I forget what it was offhand, but where I worked before I remember we had to modify scripts to do that.
Not sure if that is your issue, but would be a good place to start.
twinedev wrote:There are some setting for dealing with connecting to a SSL site (you can tell it to try to not verifying the certificate). I forget what it was offhand, but where I worked before I remember we had to modify scripts to do that.
(Also, are you getting any type of errors?)
I found this in the documentation and added it. It seems that the redirect I put in the array that is processed on their server is working however the data is still not getting posted.
// alllow all ssl certificates
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
As long as you trust the site that you are logging onto then that is fine but normally that would be a major security risk as that basically is saying ignore all facts that the security certificate is not verified or recognised and go ahead anyway and connect.
If you are planning on connecting to other sites that you are not sure about then I would suggest you review your script to be more secure and if possible download the certificate by viewing the address in your browser normally and refering to that certificate you have to install when connecting via cURL.