1
My submission is returning this error ...
Warning: file_get_contents(https://webto.salesforce.com/servlet/servlet.WebToLead...): failed to open stream: HTTP request failed! HTTP/1.1 400 TLS 1.1 or Higher required in /home/Storage/9/8e/3d/teste1124/public_html/tpl/site.php on line 124
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'content' => $content,
)
));
$result = file_get_contents('https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8', null, $context);
And it looks like the file_get_contents request is using TLS 1.0, which stopped being supported by Salesforce...
Note 01 ... The line 124 of the error, in Cód is the line $result = file_get_contents , above.
I rode like this so I could test ................................................................................
$context = stream_context_create([array(
'http' => array(
'method' => 'POST',
'content' => $content,
),
'ssl' => [
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT |
STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
],
)]);
$result = file_get_contents('https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8', false, $context);
ERROR === Warning: stream_context_create(): options should have the form ["wrappername"]["optionname"] = $value in /home/Storage/9/8e/3d/teste1124/public_html/tpl/index.php on line 126
Obs 02 ... A line 126 === )]); from Cód. above.
How can I correct and correctly adjust my submission ? I’m mounting wrong shipment or what will be ?
Hello Paul, what version of PHP you are using and what is your hosting operating system?
– Guilherme Nascimento
@Guilherme Nascimento The server version is PHP Version 5.4.45 & Linux
– PauloMaia
I understand, is that if it was 5.6 some things might be different (SSL in question), but being 5.4 or 5.5 can be solved more easily. I’ll draw up a response
– Guilherme Nascimento
Yes, I’m just installing PHP5.4 here to create a functional example for you, my internet is slow and I only have PHP7.1 which is different from 5.4. I saved your question in the favorites so I don’t forget, until soon.
– Guilherme Nascimento
@Paulomaia Is there a specific reason that prevents you from using Curl? I believe it would be much easier, since just use
CURLOPT_SSLVERSION
.– Inkeliz
That’s not gonna work after all
3
is not TLS 1.1. Switch toCURL_SSLVERSION_TLSv1_2
, so thatcurl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
– Inkeliz
Then specify the
3
is the same as the Sslv3 version. Sslv3 predates TLS 1.1. The site requires you to use TLS 1.1 or higher, so useCURL_SSLVERSION_TLSv1_2
orCURL_SSLVERSION_TLSv1_1
. If you really want to use numbers instead of constants, use5
or6
. But don’t use it3
....– Inkeliz
No Answer , Someone ?
– PauloMaia