i get an error in my php source...(im not master of php)
$API_KEY = '246010911:AAFVhj7jc4kXUPfBH1**************';
$chatid = $update->callback_query->message->chat->id;
$from_id2 = $update->callback_query->from->id;
$get1 = file_get_contents("https://api.telegram.org/bot$API_KEY/getChatMember?chat_id=$chatid&user_id=".$from_id2);
and My Error :
PHP Warning: file_get_contents(https://api.telegram.org/bot****/getChatMember?chat_id=&user_id=): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
how can i fix it :(
You are defining the $API_KEY, $chatid, $from_id2 after using it.
Try this with the correct API_KEY.
$API_KEY = '246010911:AAFVhj7jc4kXUPfBH1**************';
$chatid = $update->callback_query->message->chat->id;
$from_id2 = $update->callback_query->from->id;
$get1 = file_get_contents("https://api.telegram.org/bot$API_KEY/getChatMember?chat_id=$chatid&user_id=".$from_id2);
Related
I am trying to import ibm-cos-bucket and cos-instance from IBM cloud. I am able to import cos-instance however, getting error while importing ibm-cos-bucket.
Error: rpc error: code = Unavailable desc = transport is closing
*[ERROR] : eval: *terraform.EvalRefresh, err: rpc error: code = Unavailable desc = transport is closing
[ERROR] : eval: terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
[WARN] plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
[DEBUG] plugin: plugin exited
panic: runtime error: index out of range [1] with length 1
Terraform crashed!!!
here is sample resource block:-
resource "ibm_cos_bucket" "mybucket" {}
Please help me in this regards.
Thanks in advance!
Are you using CRN or ID for import?
According to doc's ID must be used.
id = $CRN:meta:$buckettype:$bucketlocation
ID can be easily find by using data. Here is an example.
data "ibm_cos_bucket" "my-bucket" {
bucket_name = "my-bucket"
resource_instance_id = data.ibm_resource_instance.my-resource.id
bucket_region = "us-south"
bucket_type = "region_location"
}
output "bucket-info" {
value = data.ibm_cos_bucket.my-bucket.id
}
This seems to be a fault/bug of IBM provider. Simillar issue for aws is here.
Thus, you can report the problem by making the issue on IBM provider's github:
https://github.com/IBM-Cloud/terraform-provider-ibm/issues
I tried to install new Domino V10 on my test server and then added POI Plugin. It seems everything works great but when tried to create/export an excel file via POI this line does not work. Does poi work with Domino V10 or not? Any suggestion would be great.
**var wb = WorkbookFactory.create(inp);**
//POI CODE SAMPLE
var resourcePath = "/DemoExcel.xlsx";
var excelName = "DepoExcel_v1.xslx";
var bantfile = java.lang.System.getProperty("java.io.tmpdir");
var excelFilePath = bantfile+"\\"+ excelName;
var inp = facesContext.getExternalContext().getResourceAsStream(resourcePath);
var wb = WorkbookFactory.create(inp);
var sheet = wb.getSheetAt(0);
//Code continuous here...
UPDATE 2:
ERROR LOG DETAILS
CLFAD0141E: Error processing XPage request CLFAD0211E: Exception thrown CLFAD0246E: Exception occurred servicing request for: /ays/poi.nsf/xspViewMainPage.xsp - HTTP Code: 500'
I have been trying to make a HTTP POST request from plugin without lucky.
I have the same code working fine in my console appication however in plugin I get the following error: "One or more erros occured". I tried to run it asynchronously but it did not work as well.
I really appreciate any idea, thank you!
var client = new HttpClient();
var queryString = HttpUtility.ParseQueryString(string.Empty);
// Request headers
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "KEY");
// Request parameters
queryString["chave"] = "key2";
queryString["codigo_obra"] = codigoObra;
queryString["codigo_bloco"] = codigoBloco;
queryString["codigo_unidade"] = codigoUnidade;
queryString["codigo_planta"] = codigoPlanta;
var uri = "http://test?" + queryString;
HttpResponseMessage response;
// Request body
byte[] byteData = Encoding.UTF8.GetBytes("");
using (var content = new ByteArrayContent(byteData))
{
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
//This line gives me the error.
response = client.PostAsync(uri, content).Result;
}
Sometimes, while calling the https://api.spotify.com/v1/me endpoint, I receive a 502 bad gateway error. This error occurs sporadically.
I would appreciate any help. Thanks!
Code:
PublicProfile profile = null;
var url = "https://api.spotify.com/v1/me";
using (var wc = new WebClient())
{
wc.Headers.Add("Authorization", TokenType + " " + AccessToken);
var response = wc.DownloadString(url);
profile = JsonConvert.DeserializeObject<PublicProfile>(response, settings);
}
I having the same issue. A majority of time when I make this request I get the 502: Bad Gateway response. Occasionally I will get an actual response. I am using Python and rauth library to make this request, this leads me to believe this is an error on Spotify's end and not ours.
I have some problem in my project. I want to delete my file from the ftp using proxy.
My code is:
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://" + FtpServerName + FtpFilePath);
request.Method = WebRequestMethods.Ftp.DeleteFile;
request.Proxy = new WebProxy(ProxyAddress);
request.Proxy.Credentials = new NetworkCredential(ProxyUserName, ProxyPassword);
request.Credentials = new NetworkCredential(FTPUserName, FTPPassword);
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
In this i'm getting error like:
The requested FTP Command is not supported when using http proxy
can any one please help me
Thanks in advance
from http://blogs.msdn.com/b/adarshk/archive/2004/09/13/229069.aspx:
Note on using Http Proxy on FTPWebRequest: Http proxy is only supported for limited number of ftp methods (mainly to download file only), so if you have IE settings for proxy on your machine you need to explicitly set FtpWebRequest to not use proxy like below
request.Proxy = GlobalProxySelection.GetEmptyWebProxy();
If you want to perform other FTP actions through a proxy, you'll have to find another FTP component that supports it.
Instead of request.Proxy = GlobalProxySelection.GetEmptyWebProxy();
try request.Proxy = WebRequest.DefaultWebProxy;
Follows a demo code that worked well for me:
var request = (FtpWebRequest)WebRequest.Create(new Uri("ftp://99.999.99.99/TextFile1.txt"));
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential("ftp_user", "ftp_pass"); // it's FTP credentials, not proxy
request.Proxy = WebRequest.DefaultWebProxy;
var sourceStream = new StreamReader("TextFile1.txt");
byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
sourceStream.Close();
request.ContentLength = fileContents.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();
var response = (FtpWebResponse)request.GetResponse();
Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);
response.Close();