I'm trying to send some information to our CRM from a form on our site and am getting stuck on inserting the variables into the XML. Here is a simplified version of my code. Notice where I'm trying to insert the $email variable within the XML variable...which is not working.
<?php
$email = $_GET["email"];
$xml = '<xmlrequest>
<details>
<emailaddress>$email</emailaddress>
<mailinglist>8</mailinglist>
<format>html</format>
<confirmed>no</confirmed>
</details>
</xmlrequest>
';
$ch = curl_init('http://mysite.com/xml.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = #curl_exec($ch);
if ($result === false) {
echo "Error performing request";
} else {
$xml_doc = simplexml_load_string($result);
header( "Location: http://mysite.com/confirmation?email=$email" ) ;
//echo 'Status is ', $xml_doc -> status, '<br/>';
if ($xml_doc -> status == 'SUCCESS') {
echo 'Data is ', $xml_doc -> data, '<br/>';
} else {
echo 'Error is ', $xml_doc -> errormessage, '<br/>';
}
}
?>
If I just type in an email address value for the API works fine. However, I'm clueless on how to pull this in dynamically from a PHP variable. Any help is greatly appreciated!
The string definition is bad
use this
$xml = "<xmlrequest>
<details>
<emailaddress>{$email}</emailaddress>
<mailinglist>8</mailinglist>
<format>html</format>
<confirmed>no</confirmed>
</details>
</xmlrequest>";
or this
$xml = '<xmlrequest>
<details>
<emailaddress>' . $email . '</emailaddress>
<mailinglist>8</mailinglist>
<format>html</format>
<confirmed>no</confirmed>
</details>
</xmlrequest>';
Because this variable probably can be various string I think it's better if you use <![CDATA[]]> section around the email.
Related
so my issue is according to the documentation (wich is pretty slim and not the greatest) the xml i have is everything that is required, but im getting this error code back
<?xml version="1.0" encoding="UTF-8"?>
<Error><Number>80040B19</Number><Description>XML Syntax Error: Please check the XML request to see if it can be parsed.</Description><Source>USPSCOM::DoAuth</Source></Error>
this doesnt make much sense to me because my account is in production mode, and as i said according to the documentation i have everything that is required, i have spent the last 2 days trying to get this to work and nothing.
the VerifyAddress function works fine, but the RateCheck function does not work.
class USPS
{
protected $Endpoint = 'http://production.shippingapis.com/ShippingAPI.dll';
protected $SecureEndpoint = 'https://secure.shippingapis.com/ShippingAPI.dll';
protected $TestEndpoint = 'http://stg-production.shippingapis.com/ShippingAPI.dll';
protected $TestSecureEndpoint = 'https://stg-secure.shippingapis.com/ShippingAPI.dll';
private $username = 'example’;
function VerifyAddress($address1, $address2, $city, $state, $zip)
{
$xml = '<AddressValidateRequest%20USERID="'.$this->username.'">
<Address>
<Address1>'.$address1.'</Address1>
<Address2>'.$address2.'</Address2>
<City>'.$city.'</City>
<State>'.$state.'</State>
<Zip5>'.$zip.'</Zip5>
<Zip4></Zip4>
</Address>
</AddressValidateRequest>';
//build the data
$data = $this->AddressVerify . $xml;
//send for the request
$verified = $this->Request($data);
//return he results
return $verified;
}
function RateCheck($packages, $zipDest, $service='PRIORITY', $zipOrigin='93274', $pounds='3', $ounces='0',
$container='RECTANGULAR', $size='LARGE', $width='13', $length='14', $height='6', $girth='38')
{
$packageIDS = array('1ST'=>1, '2ND'=>2, '3RD'=>3, '4TH'=>4, '5TH'=>5, '6TH'=>6, '7TH'=>7, '8th'=>8,'9TH'=>9,
'10th'=>10);
$packagexml = array();
for($i=1;$i<=$packages;$i++)
{
$PackageID = array_search($i, $packageIDS);
$packagexml[] = '<Package ID="'.$PackageID.'">
<Service>'.$service.'</Service>
<ZipOrigination>'.$zipOrigin.'</ZipOrigination>
<ZipDestination>'.$zipDest.'</ZipDestination>
<Pounds>'.$pounds.'/Pounds>
<Ounces>'.$ounces.'</Ounces>
<Container>'.$container.'</Container>
<Size>'.$size.'</Size>
<Width>'.$width.'</Width>
<Length>'.$length.'</Length>
<Height>'.$height.'</Height>
<Girth>'.$girth.'</Girth>
</Package>';
}
$xml2 = '';
foreach($packagexml as $package)
{
$xml2 .= $package;
}
$data = 'API=RateV4&XML=<RateV4Request USERID="'.$this->username.'"><Revision>2</Revision>'.$xml2.'</RateV4Request>';
$RateResult = $this->Request($data);
return $RateResult;
}
function Request($data)
{
$ch = curl_init();
// set the target url
curl_setopt($ch, CURLOPT_URL,$this->Endpoint);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// parameters to post
curl_setopt($ch, CURLOPT_POST, 1);
// send the POST values to usps
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$result=curl_exec ($ch);
curl_close($ch);
$Parseresult = $this->parseResult($result);
return $Parseresult;
}
function parseResult($responce)
{
$data = strstr($responce, '<?');
echo '<!-- '. $data. ' -->'; // Uncomment to show XML in comments
$xml_parser = xml_parser_create();
xml_parse_into_struct($xml_parser, $data, $vals, $index);
xml_parser_free($xml_parser);
$params = array();
$level = array();
foreach ($vals as $xml_elem) {
if ($xml_elem['type'] == 'open') {
if (array_key_exists('attributes',$xml_elem)) {
list($level[$xml_elem['level']],$extra) = array_values($xml_elem['attributes']);
} else {
$level[$xml_elem['level']] = $xml_elem['tag'];
}
}
if ($xml_elem['type'] == 'complete') {
$start_level = 1;
$php_stmt = '$params';
while($start_level < $xml_elem['level']) {
$php_stmt .= '[$level['.$start_level.']]';
$start_level++;
}
$php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
eval($php_stmt);
}
}
return $params;
}
}
The reason I was getting this was because I had unescaped ampersands in my XML that I was posting to the USPS API. Before you POST the XML, print the XML out on your screen just to see exactly what is being posted. I'm not sure how to do this in php (maybe echo?) but in python I would do print(my_xml_string).
Like I said, my generated xml had ampersand characters in it &, I fixed the problem by replacing those with &. Again, I'm not way familiar with php but python would be my_xml_string.replace('&', '&'). This is because an ampersand in XML needs to be 'closed' with a ;.
soultion form Viable works .. by adding the following code in appropriate format
'.$pounds.'
i have demonstrated at usps tracking site and its now works well
I got following error to my site usps tracking : when i manually entered field i got result . but through the form i got that error mentioned below.
80040B19XML Syntax Error: Please check the XML request to see if it can be parsed.(B)USPSCOM::DoAuth
Finally revising quote . i got solution.
DONOT defin the value in the loop or xml tag
right <Pounds>'.$pounds.'</Pounds>
wrong <Pounds>'if($_POST['unit']=="Pounds"){ ...'</Pounds> This is creating xml VALIDATION ISSUE ..
I'm new to cURL. I'm trying to send a XML request and get its response as XML to a rest web application in a remote server.
Below is the code I'm trying to send :
<?php
//header("refresh:5;url=form.html");
if(isset($_POST['create_xml'])){
$contact = "contact";
$first_name = $_POST["element_1"];
$last_name = $_POST["element_2"];
$email = $_POST["element_3"];
$country_code=$_POST["element_4_1"];
$contact_number=$_POST["element_4_2"].$_POST["element_4_3"];
$comments = $_POST["element_5"];
//if ($first_name && $last_name && $email && $contact_number && $comments) {
//echo "Thank you for submitting your form. You may submit email service requests to our Support Center at:";
//} else {
//exit("You have not filled out all the required fields. Place hit your back button and fill out all the required fields.");
//}
$xml = '<?xml version="1.0" encoding="UTF-8"?>';
$xml .= "<command>";
$xml .= "ADD_NEW_CONTACT";
$xml .= "</command>";
$xml .= "<data>";
$xml .= "<name>";
$xml .= $first_name.''.$last_name;
$xml .= "</name>";
$xml .= "<username>";
$xml .= $email;
$xml .= "</username>";
$xml .= "<preferredemail>";
$xml .= $email;
$xml .= "</preferredemail>";
$xml .= "<mobile>";
$xml .= "<countrycode>";
$xml .= $country_code;
$xml .= "</countrycode>";
$xml .= "<mobilenumber>";
$xml .= $contact_number;
$xml .= "</mobilenumber>";
$xml .= "</mobile>";
$xml .= "<gender>";
$xml .= "TBD";
$xml .= "</gender>";
$xml .= "</data>";
$xml .= "</groupzsyncreq>";
$xml =htmlentities($xml);
//echo $xml;
/**
* Define POST URL and also payload
*/
define('XML_POST_URL', 'http://www.testapp.com/test?request=');
/**
* Initialize handle and set options
*/
$ch = curl_init();
set_time_limit(0);
curl_setopt($ch, CURLOPT_URL, XML_POST_URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));
/**
* Execute the request and also time the transaction
*/
$start = array_sum(explode(' ', microtime()));
$result = curl_exec($ch);
$stop = array_sum(explode(' ', microtime()));
$totalTime = $stop - $start;
/**
* Check for errors
*/
if ( curl_errno($ch) ) {
$result = 'ERROR -> ' . curl_errno($ch) . ': ' . curl_error($ch);
} else {
$returnCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
switch($returnCode){
case 404:
$result = 'ERROR -> 404 Not Found';
break;
default:
break;
}
}
/**
* Close the handle
*/
curl_close($ch);
/**
* Output the results and time
*/
echo 'Total time for request: ' . $totalTime . "\n";
echo $result;
/**
* Exit the script
*/
exit(0);
}
?>
Now, when I try to send the XML request from my local system , I get this error
Total time for request: 20.308043956757 ERROR -> 6: Couldn't resolve host 'www.testapp.com'. But, `www.testapp.com` is fine and is up. How to solve this error.
define('XML_POST_URL', 'http://www.testapp.com/test?request=');
I think , this is not complete.
Can you check your end point url under service tag at end of wsdl.
Change this http header as you are using xml
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
Also use this curl option for http POST
curl_setopt($ch, CURLOPT_POST, true);
I am submitting the contents of an HTML form to a 3rd-party service using cURL, and it shoots me back an XML response. But no matter what I'm doing I can't seem to parse that XML response to customize the display of the results.
Here is the code for processing the form (note a few ID numbers have been censored):
<?php
$FirstName = $_POST['FirstName'] ;
$LastName = $_POST['LastName'] ;
$Zip = $_POST['Zip'] ;
$EmailAddress = $_POST['EmailAddress'] ;
$PrimaryPhoneNumber = $_POST['PrimaryPhoneNumber'] ;
$DateofBirth = $_POST['DateofBirth'] ;
$myvars = '&VID=' . '****' . '&LID=' . '****' . '&AID=' . '****' . '&FirstName=' . $FirstName . '&LastName=' . $LastName .
'&EmailAddress=' . $EmailAddress . '&PrimaryPhoneNumber=' . $PrimaryPhoneNumber . '&Zip=' . $Zip . '&DateofBirth=' . $DateofBirth;
if ($FirstName!='' && $LastName!='' && $Zip!='' && $EmailAddress!='' && $PrimaryPhoneNumber!='' && $DateofBirth!='') {
$c = curl_init();
curl_setopt($c, CURLOPT_URL, 'http://secure.leadexec.net/leadimport.asmx/LeadReceiver');
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $myvars);
curl_exec ($c);
curl_close ($c);
} else {
echo '<p>Please make sure you have filled out the form completely</p>';
}
?>
This is the raw output of the response I get back:
<?xml version="1.0" encoding="utf-8"?>
<PostResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.leadproweb.com/">
<isValidPost>false</isValidPost>
<ResponseType>Duplicate_Lead</ResponseType>
<ResponseDetails>Duplicate Lead, Last Received On: 9/27/2013 2:17:26 PM</ResponseDetails>
<LeadIdentifier>20889333</LeadIdentifier>
<VendorAccountAssigned>0</VendorAccountAssigned>
<PendingQCReview>false</PendingQCReview>
<Price>0</Price>
<RedirectURL />
</PostResponse>
When I try using methods like SimpleXmlElement or simplexml_load_string() to parse the XML, they seem to be ignored and I can't get rid of the raw XML output unless I remove the curl_exec($c) line.
Is there something I am doing wrong?
You need to add
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
to get the value (string) of the response; otherwise, curl_exec just returns a boolean (success/failure). See http://php.net/manual/en/function.curl-exec.php
Then you replace the line
curl_exec( $c );
with
$response = curl_exec( $c );
And finally you parse the response string with a parser of your choice.
I am using xml with cURL to contact Canada post and
get shipping labels.
This is the code I use.
The platform is ExpressionEngine
<?php
/**
* Sample code for the CreateShipment Canada Post service.
*
* The CreateShipment service is used to create a new shipping item, to
* request the generation of a softcopy image of shipping labels, and to provide
* links to these shipping labels and other information associated with the
* shipping item..
*
* This sample is configured to access the Developer Program sandbox environment.
* Use your development key username and password for the web service credentials.
*
**/
// Your username, password and customer number are imported from the following file
// CPCWS_Shipping_PHP_Samples\REST\shipping\user.ini
$userProperties = parse_ini_file(realpath(dirname($_SERVER['SCRIPT_FILENAME'])) . '/../user.ini');
$username = $userProperties['username'];
$password = $userProperties['password'];
$mailedBy = $userProperties['customerNumber'];
$mobo = $userProperties['customerNumber'];
// REST URL
$service_url = 'https://ct.soa-gw.canadapost.ca/rs/' . $mailedBy . '/' . $mobo . '/shipment';
// Create CreateShipment request xml
$groupId = '4326432';
$requestedShippingPoint = 'H2B1A0';
$mailingDate = '2012-10-24';
$contractId = '0040662521';
$xmlRequest = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<shipment xmlns="http://www.canadapost.ca/ws/shipment">
<group-id>{$groupId}</group-id>
<requested-shipping-point>{$requestedShippingPoint}</requested-shipping-point>
<expected-mailing-date>{$mailingDate}</expected-mailing-date>
<delivery-spec>
<service-code>DOM.EP</service-code>
<sender>
<name>Bulma</name>
<company>Capsule Corp.</company>
<contact-phone>1 (514) 820 5879</contact-phone>
<address-details>
<address-line-1>502 MAIN ST N</address-line-1>
<city>MONTREAL</city>
<prov-state>QC</prov-state>
<country-code>CA</country-code>
<postal-zip-code>H2B1A0</postal-zip-code>
</address-details>
</sender>
<destination>
<name>Ryuko Saito</name>
<company>Kubere</company>
<address-details>
<address-line-1>23 jardin private</address-line-1>
<city>Ottawa</city>
<prov-state>ON</prov-state>
<country-code>CA</country-code>
<postal-zip-code>K1K4T3</postal-zip-code>
</address-details>
</destination>
<options>
<option>
<option-code>DC</option-code>
</option>
</options>
<parcel-characteristics>
<weight>15</weight>
<dimensions>
<length>6</length>
<width>12</width>
<height>9</height>
</dimensions>
<unpackaged>true</unpackaged>
<mailing-tube>false</mailing-tube>
</parcel-characteristics>
<notification>
<email>ryuko.saito#kubere.com</email>
<on-shipment>true</on-shipment>
<on-exception>false</on-exception>
<on-delivery>true</on-delivery>
</notification>
<print-preferences>
<output-format>8.5x11</output-format>
</print-preferences>
<preferences>
<show-packing-instructions>true</show-packing-instructions>
<show-postage-rate>false</show-postage-rate>
<show-insured-value>true</show-insured-value>
</preferences>
<settlement-info>
<contract-id>{$contractId}</contract-id>
<intended-method-of-payment>Account</intended-method-of-payment>
</settlement-info>
</delivery-spec>
</shipment>
XML;
$curl = curl_init($service_url); // Create REST Request
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_CAINFO, realpath(dirname($argv[0])) . '/../../../third-party/cert/cacert.pem'); // Signer Certificate in PEM format
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $xmlRequest);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/vnd.cpc.shipment-v2+xml', 'Accept: application/vnd.cpc.shipment-v2+xml'));
$curl_response = curl_exec($curl); // Execute REST Request
if(curl_errno($curl)){
echo 'Curl error: ' . curl_error($curl) . "\n";
}
echo 'HTTP Response Status: ' . curl_getinfo($curl,CURLINFO_HTTP_CODE) . "\n";
curl_close($curl);
// Example of using SimpleXML to parse xml response
libxml_use_internal_errors(true);
$xml = simplexml_load_string('<root>' . preg_replace('/<\?xml.*\?>/','',$curl_response) . '</root>');
if (!$xml) {
echo 'Failed loading XML' . "\n";
echo $curl_response . "\n";
foreach(libxml_get_errors() as $error) {
echo "\t" . $error->message;
}
} else {
if ($xml->{'shipment-info'} ) {
$shipment = $xml->{'shipment-info'}->children('http://www.canadapost.ca/ws/shipment');
if ( $shipment->{'shipment-id'} ) {
echo 'Shipment Id: ' . $shipment->{'shipment-id'} . "\n";
foreach ( $shipment->{'links'}->{'link'} as $link ) {
echo $link->attributes()->{'rel'} . ': ' . $link->attributes()->{'href'} . "\n";
}
}
}
if ($xml->{'messages'} ) {
$messages = $xml->{'messages'}->children('http://www.canadapost.ca/ws/messages');
foreach ( $messages as $message ) {
echo 'Error Code: ' . $message->code . "\n";
echo 'Error Msg: ' . $message->description . "\n\n";
}
}
}
?>
I received error below
HTTP Response Status: 500 Error Code: Server Error Msg: illegal character 'X' at offset 37 of /rs/0000000000/0000000000/shipment
(I changed customer number to "0000000000")
Can someone explain what is the meaning of above message?
Thank you very much
The provider is probably (like all "enterprise" providers) not using a proper XML parser. Try putting a space before the closing characters of the PI, or failing that remove the PI entirely.
37 characters puts you right at the end of the XML Prolog
<?xml version="1.0" encoding="UTF-8"?>
Either the host does not handle this or you have may have a DOS/UNIX End-of-Line issue.
First, try removing the XML Prolog and see if that helps.
If that doesn't help, then (depending on your editor) save the PHP source as a UNIX file to get the end of line markers right. If that doesn't work, try saving it as a DOS file.
OK, I have this php file for my HSBC bank processing using the API, I have this working fine on 2 of my other websites, however the SAME file is failing on the other two sites, I have no idea why. My web developer is stumped and decided to create a test file, Here is the code from the test file:
<?php
echo "payment processing...";
$amount = 100;// round($_POST["realamount"], 2) * 100;
$fullName = "test";//$_POST['name'];
$Address1 = "test";//$_POST['address1'];
$Address2 = "test";//$_POST['address2'];
$city ="test";// $_POST['city'];
$county = $city;
$postcode = "test";//$_POST['zipcode'];
$country = "GRB";//$_POST['country'];
$phone = "test";//$_POST['telephone'];
$email = "a#a.com";//$_POST['emailaddress'];
$cardNumber = "337877666233434";//$_POST['cardNumber'];
$cardExp = "03/2011";//$_POST['ccmonth'] . "/" . substr($_POST["ccyear"],2,2);
$cvdIndicator = "111";//$_POST['cvdIndicator'];
$cvdValue = "111";//$_POST['cvdValue'];
$issueNumber = "111";//$_POST['issueNumber'];
$cardType = "VI";//$_POST['cardType'];
$testRead = "<?xml version='1.0' encoding='UTF-8'?>
<EngineDocList>
<DocVersion>1.0</DocVersion>
<EngineDoc>
<ContentType>OrderFormDoc</ContentType>
<User>
<Name>xxx</Name>
<Password>xxx</Password>
<ClientId>xxx</ClientId>
</User>
<Instructions>
<Pipeline>PaymentNoFraud</Pipeline>
</Instructions>
<OrderFormDoc>
<Mode>P</Mode>
<Comments/>
<Consumer>
<Email/>
<PaymentMech>
<CreditCard>
<Number>".$cardNumber."</Number>
<Expires DataType='ExpirationDate' Locale='840'>".$cardExp."</Expires>
<Cvv2Val>".$cvdValue."</Cvv2Val>
<Cvv2Indicator>".$cvdIndicator."</Cvv2Indicator>
<IssueNum>".$issueNumber."</IssueNum>
</CreditCard>
</PaymentMech>
</Consumer>
<Transaction>
<Type>Auth</Type>
<CurrentTotals>
<Totals>
<Total DataType='Money' Currency='826'>".$amount."</Total>
</Totals>
</CurrentTotals>
</Transaction>
</OrderFormDoc>
</EngineDoc>
</EngineDocList>";
?>
<?php
//$url = "https://www.uat.apixml.netq.hsbc.com";
$url = "https://www.secure-epayments.apixml.hsbc.com/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$testRead);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$result_tmp = curl_exec ($ch);
curl_close ($ch);
///////////////////////////////////////
// use XML Parser result
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser,XML_OPTION_CASE_FOLDING,0);
xml_parser_set_option($xml_parser,XML_OPTION_SKIP_WHITE,1);
xml_parse_into_struct($xml_parser, $result_tmp, $vals, $index);
xml_parser_free($xml_parser);
//print_r($vals); // print all the arrays.
//print_r($vals[29]); // print only the selected array.
$val1 = $vals[21];
// ProcReturnMsg
$paymentResult = $val1[value];
$result_tmp = "";
$k=0;
$findthis = false;
$findthis2 = false;
foreach ($vals as $val) {
$result_tmp.= $k."{";
foreach($val as $d => $a) {
$result_tmp.="[".$d."]".$a;
if($d=="tag" && $a=="TransactionStatus"){
$findthis = true;
}
if($d=="value" && $findthis){
$tResult = $a;
$findthis = false;
}
if($d=="tag" && $a=="Text"){
$findthis2 = true;
}
if($d=="value" && $findthis2){
$tResult2 = $a;
$findthis2 = false;
}
}
$result_tmp.= "}";
$k++;
}
echo $tResult2.$tResult;
?>
Here is an example of one of the sites not working gs.net
The output is:
payment processing... The HTTP method received is not valid. Only POST is accepted.
Whereas when I upload this exact same file to some of my other web hosts such as:
HGL working example
The output here is payment processing... Unable to determine card type. ('length' is '15')E
This sounds like an error message, but basically that error is not important, so the latter is what we are trying to achieve in the first link.
I have even uploaded this file to some really basic hosting accounts of mine, sometimes it will work sometimes it won't, so I'm guessing it's something to do with what the hosting company are allowing or have switched On/Off.
Any ideas please?
Thank you
This seems to have been caused by a PHP upgrade applied to the server and it was driving me crazy.
The solution is to set the following SSL options when specifying the CURL connection.
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'RC4-MD5');
check if curl is enabled on those servers that don't work for starters. use phiinfo() function to check.