0
How to go from ...
file_get_contents()
for CURL or Guzzle
$content = http_build_query(array(
'oid' => '00SH1000000ASZF',
'retURL' => 'https://www.site.com.br/',
'first_name' => $nome,
'last_name' => $sobrenome,
'cpf__c' => rmCaracter($f['cpf']),
'mobile' => rmCaracter($f['phone']),
'email' => $f['email'],
'type__c' => 'HAB',
'Lead_Source' => 'Website Concessionaria',
'sub_source_media__c' => 'Site',
'dealer_code_interest__c' => '137492',
'opt_in_email__c' => '1',
'opt_in_phone__c' => '1',
'model_interest__c' => $f['model'],
));
$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);
I’m getting an error in $result .::
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
I believe I’m the solution because, uh... If I put the url of this webservice in the action of a form and send the same data, I don’t have the error, but the way I mounted my json , yes I have this error there.
My Form + Json = https://pastebin.com/mvai8JP7
Most housings now lock the furl_open parameter which allows using file_get_contents() to load data from a URL external. I think I can use CURL or a PHP client library as Guzzle, as solution.
Edith your question and clarify your problem, because the way you are not to understand.
– NoobSaibot
@Wéllingthon M. de Souza I need to change my JSON to CURL because ... I believe to be the Solution because, ... If I put the url of this webservice in the action of a form and send the same data, I do not have the error, but the way I mounted my json , yes I have this error there.
– PauloMaia
@Articuno Can help you know........ I’m not getting through !
– PauloMaia