Categories
Mastering Development

PHP curl_multi_init change proxy

I would like to make some simultaneous requests with curl_multi_init using proxies but I don’t know how to check in a request if the proxy is banned and then change the proxy and restart the request. Thank you My code : <?php $thread = []; for($i = 0; $i < 50; $i++) { $thread[$i] = […]

Categories
Mastering Development

I can not log in to the site through curl

I can’t understand what I’m doing wrong. There is a service site: https://demo.moneta.ru/login.htm. The usual form with a token. I knock on the page, save the cookies, take the token from the form. The next request I send to the address from the form data. With cookies and token. I get a fig. 401. I […]

Categories
Mastering Development

Trying to create a c++ PUT request with curl with a certain body

What I’m trying to recreate is this curl request. curl -X PUT –header ‘Content-Type: application/json’ –header ‘Accept: application/json’ –header ‘Authorization: Basic securePasswordHash’ -d ‘{“IconID”: 54}’ ‘https://127.0.0.1:1233/api/v1/current/icon’ This command does work. I’m trying to translate that into C++ code. So far, my code looks like this: std::string wHeader = (“Authorization: Basic ” + wLCUEncoded); std::string strJson […]

Categories
Development

How can I send leads to specific mailing list depending on their selection (Using Mailchimp)?

I am trying to link my newsletter form with my Mailchimp list however, I want the lead to go into a specific list depending on the selection the user makes. For example, if they select the “I am a Worker” option from the HTML code below, they will be subscribed into the “Workers” mailing list. […]

Categories
Development

Cannot delete a SFTP file using cURL

I have a weird issue with deleting or using rm with cURL. It works just fine when I try to delete or move files using the same credentials on FileZilla, but doesn’t work when running it through cURL. Do I have any issues with my code? $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $sftp_server.$file_name); curl_setopt($ch, CURLOPT_USERPWD,$user_pwd); curl_setopt($ch, […]

Categories
Development

Channelid add notification php

I am sending a notification with the android php file, right now it is empty because I need to add channelID. How do I define Array to channelID? Empty notification going because of no channelID <?php sendNotification($title,$message,”android”); function sendNotification($title=””,$message=””,$type=”android”) { $path_to_fcm = ‘https://fcm.googleapis.com/fcm/send’; $server_key = “..”; if($type==”ios”){ // IOS KEY $finalKey = array(‘..’); }else{ // […]

Categories
Development

I get an undefined offset after passing the requests into the function

I’m trying to get the time taken to reach a distance using google distantmatrix.I get this error after passing the the required arguments into the function. Public function GetDrivingDistance($lat1, $lat2, $long1, $long2) { $data1 = setting::where(‘id’,1)->first(); $key = $data1->key; $url = “https://maps.googleapis.com/maps/api/distancematrix/json?origins=”.$lat1.”,”.$long1.”&destinations=”.$lat2.”,”.$long2.”&mode=driving&language=pl-PL”.”&key=”.$key; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_PROXYPORT, 3128); curl_setopt($ch, […]

Categories
Development

PHP CURL not working on multi-dimenstional array

I have a PHP script to update contact details via CURL, it has to do 2 updates, one to clients, 1 to contacts. The clients bit works, but the contacts just updates the database with blanks, it doesn’t leave the values, it completely wipes them, can anyone see a reason for this? Thanks Code below: […]

Categories
Development

libcurl Error: “Peer certificate cannot be authenticated with given CA certificates”

I am trying to connect to a FreeBSD server from Mac OS X (High Sierra) through HTTPS. We are using self-signed certificate. I am downloading the certificate using the command /usr/bin/openssl s_client -tls1_2 -connect 192.168.5.140:443 The code I am using to connect is curl_easy_setopt(curl, CURLOPT_URL, Serveraddress); curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 60); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, request); curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); […]

Categories
Development

Migrate from GCM to FCM

Recently I`ve migrated from GCM to FCM and past few days I’m struggling to make it work. Android Apps are receiving notifications from google firebase console but they don’t from php server. This is my PHP server side code: <?php define(“GOOGLE_API_KEY”, Setting::get(‘browser_key’) ? Setting::get(‘browser_key’) : “”); class GCM { function __construct() { } public function […]