小编Ces*_*are的帖子

如何使用Telegram Desktop发送位置?

我正试图在Telegram中移动我的第一步,对于入门级问题我很抱歉.

我正在尝试使用一些我想要复制的简单Bot然后进化它们:在我的电脑(Win7)上从Telegram Desktop测试这些机器人,我应该发送我的位置以获得一些响应.

例如,尝试使用Farmacie Italiane作为机器人.....

机器人建议我使用右下角的图标(图片中"Scrivi un messaggio"的左侧),

在此输入图像描述

但是当我点击它时,我可以上传文件或照片.

我如何将我的职位发送到机器人?

任何建议都很感激...提前谢谢!

切萨雷

telegram telegram-bot

9
推荐指数
1
解决办法
7825
查看次数

使用php jsonpath解析JSON

我正在尝试使用jsonpath解析PHP中的JSON ....

我的JSON来自于此

https://servizionline.sanita.fvg.it/tempiAttesaService/tempiAttesaPs

(这里剪切/粘贴太长了,但你可以在浏览器会话中看到它......)

JSON是一个有效的JSON(我已经使用https://jsonlint.com/ ... 验证了它).

我已经尝试使用http://www.jsonquerytool.com/的jsonpath表达式,所有看起来都很好,但是当我把所有的PHP代码示例放在下面....

<?php  
    ini_set('display_errors', 'On');
    error_reporting(E_ALL);

    require_once('json.php');      // JSON parser
    require_once('jsonpath-0.8.0.php');  // JSONPath evaluator

    $url = 'https://servizionline.sanita.fvg.it/tempiAttesaService/tempiAttesaPs';

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($ch, CURLOPT_PROXY, '');
    $data = curl_exec($ch);
    curl_close($ch);

    $parser = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
    $o = $parser->decode($data);

    $xpath_for_parsing = '$..aziende[?(@.descrizione=="A.S.U.I. - Trieste")]..prontoSoccorsi[?(@.descrizione=="Pronto Soccorso e Terapia Urgenza Trieste")]..dipartimenti[?(@.descrizione=="Pronto Soccorso Maggiore")]..codiciColore[?(@.descrizione=="Bianco")]..situazionePazienti..numeroPazientiInAttesa';

    $match1 = jsonPath($o, $xpath_for_parsing);
    //print_r($match1);
    $match1_encoded = $parser->encode($match1);
    print_r($match1_encoded); …
Run Code Online (Sandbox Code Playgroud)

php parsing json jsonpath

8
推荐指数
1
解决办法
2983
查看次数

如何在Selenium Web Driver中使用SSL证书?

我在Windows 7上使用Selenium Web Driver.

我正在尝试测试使用身份验证的网站,我需要使用SSL证书.

当我从Selenium中使用Firefox时,一切正常,但我注意到Selenium打开的Firefox浏览器会话没有注册任何证书,所以很明显它不起作用.

当我使用Selenium的Firefox"out"时,你就是高级首选项

在此输入图像描述

当我使用Selenium打开的Firefox会话时,你就会一样

在此输入图像描述

我试图保持会话打开并手​​动注册证书,但浏览器会话不会注册证书.

如果可能有用,那么你就是我的代码

package myTestProjects;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class GAMOPERA_Test_01 {

private static WebDriver driver = null;

public static void main(String[] args)  throws InterruptedException {

    // Create a new instance of the Firefox driver
    System.out.println("Creo una nuova sessione del browser Firefox ...");
    driver = new FirefoxDriver();

    //Put a Implicit wait, this means that any search for elements on the page could take the time the implicit wait …
Run Code Online (Sandbox Code Playgroud)

java ssl selenium selenium-webdriver

6
推荐指数
1
解决办法
1万
查看次数

如何在Apache 2.4(Windows 7)上为PHP 5.6.14配置SQLite3?

我在Windows 7上,在Apache 2.4上使用PHP 5.6.14版,我正在尝试访问SQLite3数据库.

我正在......

致命错误:找不到类"SQLite3"

在这里你是一个简单的PHP代码...

<?php
  $db = new SQLite3('phpdb');

  if ($db) {
    $db->query("CREATE TABLE dogbreeds (Name VARCHAR(255), MaxAge INT);");
    $db->query("INSERT INTO dogbreeds VALUES ('Doberman', 15)");
    $result = $db->query("SELECT Name FROM dogbreeds");
    var_dump($result->fetchArray(SQLITE3_ASSOC));
  } else {
    print "Connection to database failed!\n";
  }
?>
Run Code Online (Sandbox Code Playgroud)

我刚刚在我的php.ini文件中进行此配置时,我只是在寻找有关此信息的信息...

extension=php_pdo_sqlite.dll
extension=php_sqlite3.dll
sqlite3.extension_dir = "D:\Cesare\Lavoro\Utili\Php\5-6-14\ext"
Run Code Online (Sandbox Code Playgroud)

有什么建议?非常感谢你提前....

切萨雷

php sqlite apache2.4 php-5.6

6
推荐指数
1
解决办法
2万
查看次数

Telegram + PHP (Windows 7):无法打开流:HTTP 请求失败!HTTP/1.1 404 未找到

我正在尝试迈出 Telegram 的第一步,而且我也是 PHP 的新手......

我已经在我的 Windows 7 电脑上配置了带有 PHP 5.6.14 和 SSL 的 Apache 2.4,并且它在 http 和 https 中运行良好。

然后我尝试遵循此 Telegram Bot 教程https://www.youtube.com/watch?v=hJBYojK7DO4。一切都工作正常,直到我必须创建一个像这样的简单 PHP 程序

<?php
  $botToken = "<my_bot_token>";
  $website = "https://api.telegram.org/bot".$botToken; 
  $update = file_get_contents($website."/getUpates"); 
  print_r($update);
?>
Run Code Online (Sandbox Code Playgroud)

当我尝试输入浏览器时

https://localhost/Telegram/MyYouTubeTutorialBot/YouTubeTutorialBot.php
Run Code Online (Sandbox Code Playgroud)

响应是

Warning: file_get_contents(https://api.telegram.org/<my_bot_token>/getupates): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in <my_php_file_location> on line 6
Run Code Online (Sandbox Code Playgroud)

我在网上搜索了类似的问题,但没有解决任何问题:最有趣的响应是这个问题file_get_contents - failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found但我不明白如何使其适应我的情况。

在其他回复中,建议使用curl,但我想解决持续的file_get_contents 函数。

我认为这不是 PHP …

php apache2.4 php-5.6 telegram telegram-bot

5
推荐指数
1
解决办法
3144
查看次数

将GeoJSON放在Leaflet贴图上:无效的GeoJSON对象.抛出新的错误('无效的GeoJSON对象.');

我在使用构建GeoJSON并将其放在地图上的Leaflet代码时遇到了一些麻烦.

GeoJSON是根据服务的XML响应构建的.

错误是

无效的GeoJSON对象.抛出新的错误('无效的GeoJSON对象.');

我的代码是......

<html>
<head>
<title>Prova caricamento WMS Indirizzi del PCN</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css"/>
</head>
<body>
<div id="map" style="width: 600px; height: 400px"></div>

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>   
    <script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet-src.js"></script>

<script>

    var browser = navigator.userAgent.toLowerCase();
    var isIE = (browser.indexOf("msie")>-1 || browser.indexOf("trident")>-1);


    if (isIE && window.XDomainRequest) {
                    if (window.XDomainRequest) {
                        var query = 'http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/wfs/Numeri_Civici_2012.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=IN.NUMERICIVICI.2012&SRSNAME=EPSG:4326&bbox=7.719,44.849,7.72,44.85&outputFormat=GML2';
                        var xdr = new XDomainRequest();
                        if (xdr) {
                            xdr.onload = function () {
                                addressPCN(data);                               
                            }
                            xdr.onerror = function () { 
                                alert("KO");
                            } …
Run Code Online (Sandbox Code Playgroud)

geojson leaflet

3
推荐指数
2
解决办法
6256
查看次数

使用 PHP 向 Telegram 机器人发送消息

我正在尝试使用此 PHP 代码中的 CURL 向 Telegram Bot 发送消息......

 <?php
  $botToken="<MY_DESTINATION_BOT_TOKEN_HERE>";

  $website="https://api.telegram.org/bot".$botToken;
  $chatId=1234567;  //Receiver Chat Id
  $params=[
      'chat_id'=>$chatId,
      'text'=>'This is my message !!!',
  ];
  $ch = curl_init($website . '/sendMessage');
  curl_setopt($ch, CURLOPT_HEADER, false);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, ($params));
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  $result = curl_exec($ch);
  curl_close($ch);
?>
Run Code Online (Sandbox Code Playgroud)

代码运行没有错误,但我的目标 Telegram bot 中没有显示任何消息。

令牌是什么BotFather给我,当我建立了我的目的地电报机器人(使用此令牌访问HTTP API: <MY_DESTINATION_BOT_TOKEN>

任何建议将不胜感激......

php curl telegram-bot

2
推荐指数
1
解决办法
2万
查看次数

如何在Telegram中使用setWebhook和Windows 7和PHP上的自我证书?

我是电报中的新手,我正在尝试用它来完成我的第一步.

我在这里找到了一个很好的教程https://www.youtube.com/watch?v=hJBYojK7DO4:我用PHP和SSL配置了我的Apache 2.4,一切正常,也是教程中的示例.

当我尝试放入浏览器时,麻烦正在使用setWebhook方法....

https://api.telegram.org/<my_bot_code>/setWebHook?url=https://localhost/Telegram/MyYouTubeTutorialBot/YouTubeTutorialBot.php
Run Code Online (Sandbox Code Playgroud)

反应是

{"ok":false,"error_code":400,"description":"Error: Bad webhook: Error: Ip is reserved"}
Run Code Online (Sandbox Code Playgroud)

请注意,我正在使用自生成的证书....

我在api Telegram文档中找到了(参考https://core.telegram.org/bots/faq#i-39m-having-problems-with-webhooks),

" .....要使用自签名证书,您需要使用setWebhook中的certificate参数上传您的公钥证书.请上传为InputFile,发送字符串将无效. "

我不明白如何上传我的公钥证书文件......任何地方的例子?

问题可能是因为我使用localhost和我的本地Apache 的默认IP地址127.0.0.1?我应该使用每次连接到网络时更改的当前更改我的IP地址(我使用互联网密钥将我连接到网络.....)?

非常感谢你提前

php ssl apache2.4 telegram telegram-bot

1
推荐指数
2
解决办法
1万
查看次数