Pesquisar na Comunidade
Mostrando resultados para as tags ''api''.
Encontrado 55 registros
-
Estou testando um modo de pegar dados de um banco com uma API simples, não sei se esta certa, se poderem me dar uma ajuda Queria que ela funcionasse via POST, mas os testes no POSTMAN so retorna se eu colocar REQUEST header('Content-type: application/json'); $chave_de_acesso = "teste"; if($_POST['chave_de_acesso'] == $chave_de_acesso){ $array = array( "acesso" => 'ok' ); } else { $array = array( "acesso" => 'erro' ); } echo json_encode($array); Teste com POST Teste com REQUEST
-
Podem me ajudar como posso criar um botão de pagamento com essa api: https://ecommerce.picpay.com/doc Eu não entendi como organizar o codigo
-
$data = file_get_contents("https://servicodados.ibge.gov.br/api/v1/localidades/estados"); echo "<pre>"; print ($data); echo "</pre>"; este código está me retornando isso: ����N�@�_��5&*�;(�h�;��J'0 ̐i�h|㚝o�sP�9�%��]Ӝ����so�ޘLY����2�X����u��k��*-��$�ʈ�$���������䂽�w�s��N6��I�q�5�jE�'��O�|Cr�[|ϩ⁓�d�O�%T���x3��j���9�\*OK�A5��'dH-�O]�BV��7Y �����-v-�������Xs.�K�"�F*�T���_�i��F���d]�XE����M+!|����f�����������6>�8�r=�e͖l����D0.�.� vU���q��1�N8�6���\z���� L�����'%�i��hs�z�n� ���}��IyjT���$sĮ fs���-� �����m�
-
Olá pessoal, já pesquisei sobre o assunto mas não encontrei nada. Gostaria de saber se alguém pode me ajudar a pegar a quantidade de curtidas de uma página do facebook com php ou me indicar um tutorial. Obrigado.
-
Olá, Tenho um banco de dados onde temos vários eventos e suas localizações em longitude e latitude, porém preciso converter em endereço. Consegui um código mas ele não funciona, vocês poderiam me ajudar? $lat = '-18.8786'; $lon = '-48.3000'; function Get_Address_From_Google_Maps($lat, $lon) { $url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=$lat,$lon&key=<AQUI ESTÁ MINHA API KEY>"; // Make the HTTP request $data = @file_get_contents($url); // Parse the json response $jsondata = json_decode($data,true); // If the json data is invalid, return empty array if (!check_status($jsondata)) return array(); $address = array( 'country' => google_getCountry($jsondata), 'province' => google_getProvince($jsondata), 'city' => google_getCity($jsondata), 'street' => google_getStreet($jsondata), 'postal_code' => google_getPostalCode($jsondata), 'country_code' => google_getCountryCode($jsondata), 'formatted_address' => google_getAddress($jsondata), ); return $address; } /* * Check if the json data from Google Geo is valid */ function check_status($jsondata) { if ($jsondata["status"] == "OK") return true; return false; } /* * Given Google Geocode json, return the value in the specified element of the array */ function google_getCountry($jsondata) { return Find_Long_Name_Given_Type("country", $jsondata["results"][0]["address_components"]); } function google_getProvince($jsondata) { return Find_Long_Name_Given_Type("administrative_area_level_1", $jsondata["results"][0]["address_components"], true); } function google_getCity($jsondata) { return Find_Long_Name_Given_Type("locality", $jsondata["results"][0]["address_components"]); } function google_getStreet($jsondata) { return Find_Long_Name_Given_Type("street_number", $jsondata["results"][0]["address_components"]) . ' ' . Find_Long_Name_Given_Type("route", $jsondata["results"][0]["address_components"]); } function google_getPostalCode($jsondata) { return Find_Long_Name_Given_Type("postal_code", $jsondata["results"][0]["address_components"]); } function google_getCountryCode($jsondata) { return Find_Long_Name_Given_Type("country", $jsondata["results"][0]["address_components"], true); } function google_getAddress($jsondata) { return $jsondata["results"][0]["formatted_address"]; } /* * Searching in Google Geo json, return the long name given the type. * (If short_name is true, return short name) */ function Find_Long_Name_Given_Type($type, $array, $short_name = false) { foreach( $array as $value) { if (in_array($type, $value["types"])) { if ($short_name) return $value["short_name"]; return $value["long_name"]; } } } /* * Print an array */ function d($a) { echo "<pre>"; print_r($a); echo "</pre>"; }