I have this curl request below, which was successfully troubleshooted in another post, my PHP By working without any errors, IF runs on the next part of the statement and sends the confirmation email. It does not just update the database because it should be from the web service. If I do not have to do this then I have to email the web service creator, but I want to ensure that the code is quite solid before doing this. Any one have any ideas? Here's the code:
$ url = 'http://127.0.0.1:85/AccountCreator.ashx'; $ Curl_post_data = array ('companyname' = & gt; urlencode ($ companyname), 'main contact' = & gt; urlencode ($ main contact), 'telephone1' => urlencode ($ telephone1), 'email '= & Gt; urlencode ($ e-mail),' contact2 '= & gt; urlencode ($ contact2),' telephone2 '=> urlencode ($ telephone2),' email2 '= & gt; Urlencode ($ email2), 'package' = & gt; urlencode ($ package);; Forex currency ($ curl_post_data $ key = & gt; $ value) {$ fields_string = $ Key '=' $ Value '& Amp;'; } Rtrim ($ fields_string, '& amp;'); // die ("Test:". $ Fields_string); $ Ch = curl_init (); Curl_setopt ($ CH, CURLOPT, $ url); Curl_setopt ($ ch, CURLOPT_POST, calculation ($ curl_post_data)); Curl_setopt ($ CH, CURLOPT_POSTFIELDS, $ fields_string); $ Result = curl_xac ($ CH); Curl_close ($ ch);
First of all, what's the problem? This problem would be easy to troubleshoot if you explained what was the failure of the code. Secondly, you have some weird things in this code:
I do not know why you are doing
curl_setopt ($ ch, CURLOPT_POST, count ($ curl_post_data) );
CURLOPT_POST requires a Boolean (true / false) setting. You should set it to true
.
Secondly, you do not need to manually encode CURLOPT_POSTFIELDS
. Create an array and let it work internally:
$ curl_post_data = array ('companyname' = & gt; $ companyName, 'mainContact' = & gt; $ mainContact, 'telephone1' = & Gt; $ telephone), 'email' = & gt; $ Email, 'contact2' = & gt; $ Contact2, 'telephone2' = & gt; $ Telephone2, 'email2' = & gt; $ Email2, 'package' = & gt; $ Package);
They can not fix this problem, but they can help.
Comments
Post a Comment