Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
eai pessoal,preciso enviar
isso:
BODY
{
"esquema": 3,
"atleta": [
37788,
71116,
39152,
50427,
87225,
62009,
81682,
87863,
78435,
68930,
90651,
62136
]
}
em post para essa url /?p=auth/time/salvar&token=<token>
tentei fazer asim mas n deu:
<?php
/////////////////////////LOGIN\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
$email = $_POST['email'];
$senha = $_POST['senha'];
$jsonurl = "[http://cartolaboladao.16mb.com/api/?p=login&login=".$email."&password=".$senha;](http://cartolaboladao.16mb.com/api/?p=login&login=)
//Retorna o conteudo do arquivo em formato de string
$json = file_get_contents($jsonurl,0,null,null);
//Decodificando a string e criando o json
$json_output = json_decode($json);
$token = $json_output->glbId;$url = "http://cartolaboladao.16mb.com/api/?p=auth/time/salvar&token=".$token;
$data = '{
"esquema": 3,
"atleta": [
37788,
71116,
39152,
50427,
87225,
62009,
81682,
87863,
78435,
68930,
90651,
62136
]
}';
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
var_dump ($options);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);var_dump($result);
if(is_callable('curl_init')){
echo "Enabled";
} echo "Not enabled";
}
?>>
E isso é referente a...? CSS / XML / XHTML / HTML? JavaScript (JSON, NodeJS...)? PHP?
E o que você tentou fazer? Você quer tirar uma dúvida ou quer um freelancer grátis?
amigo teentei fazer assim mas retona um erro
<?php
/////////////////////////LOGIN\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
$email = $_POST['email'];
$senha = $_POST['senha'];
$jsonurl = "/api/?p=login&login=".$email."&password=".$senha;
//Retorna o conteudo do arquivo em formato de string
$json = file_get_contents($jsonurl,0,null,null);
//Decodificando a string e criando o json
$json_output = json_decode($json);
$token = $json_output->glbId;$url = "/api/?p=auth/time/salvar&token=".$token;
$data = '{
"esquema": 3,
"atleta": [
37788,
71116,
39152,
50427,
87225,
62009,
81682,
87863,
78435,
68930,
90651,
62136
]
}';
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
var_dump ($options);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);var_dump($result);
?>Ok, qual erro ele retorna? Por favor tire uma dúvida, mas a deixe completa, não vá publicando em partes. Quando você possui um problema, normalmente deve ser especificado. Dúvida + Código + Problema.
Abraços.
E isso é referente a...? CSS / XML / XHTML / HTML? JavaScript (JSON, NodeJS...)? PHP?
E o que você tentou fazer? Você quer tirar uma dúvida ou quer um freelancer grátis?