I have using sms gateway api on my server
$live_url = "http://sms6.routesms.com:8000/bulksms/bulksms?username=XXX&password=XXX&type=1&dlr=0&destination=XXX&source=routesms&message=CurlSecond";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $live_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
For this,
if i do var_dump(curl_exec($ch));, It is showing false
if i do var_dump(curl_getinfo($ch));, It is showing like
array(26) { ["url"]=> string(153) "http://sms6.routesms.com:8000/bulksms/bulksms?username=XXX&password=XXX&type=1&dlr=0&destination=XXX&source=routesms&message=CurlSecond" ["content_type"]=> NULL ["http_code"]=> int(0) ["header_size"]=> int(0) ["request_size"]=> int(0) ["filetime"]=> int(-1) ["ssl_verify_result"]=> int(0) ["redirect_count"]=> int(0) ["total_time"]=> float(62.345893) ["namelookup_time"]=> float(0.08692) ["connect_time"]=> float(0) ["pretransfer_time"]=> float(0) ["size_upload"]=> float(0) ["size_download"]=> float(0) ["speed_download"]=> float(0) ["speed_upload"]=> float(0) ["download_content_length"]=> float(-1) ["upload_content_length"]=> float(-1) ["starttransfer_time"]=> float(0) ["redirect_time"]=> float(0) ["certinfo"]=> array(0) { } ["primary_ip"]=> string(0) "" ["primary_port"]=> int(0) ["local_ip"]=> string(0) "" ["local_port"]=> int(0) ["redirect_url"]=> string(0) "" }
What i have to do?
I can't understand the issue?
I have tried one more way, Instead of curl, i have used
file($live_url);
This is also not working
Please cross check is curl is installed on your server, if curl is not installed try following.
If it is ubontu server RUN
sudo apt-get install php5-curl
Restart Your Server
sudo service apache2 restart
Alternatively, if you are using php-fpm, you'll need to restart php5-fpm instead
sudo service php5-fpm restart
Hope this works ...
Related
the photo before loading in the preview is correct, but on the server it is already saved sideways
Image save code:
public function postUploadImage($path, $id) {
$img = new Imagick($path);
$profiles = $img->getImageProfiles("icc", true);
$img->stripImage();
if(!empty($profiles))
$img->profileImage("icc", $profiles['icc']);
$img->cropThumbnailImage(500, 500);
$img->setImageCompressionQuality(80);
$img->writeImage($_SERVER['DOCUMENT_ROOT'] . '/public/materials/'.$id.'.jpg');
$img->clear();
}
I kind of understand that the problem is EXIF, but how to get rid of them if stripImage () does not work
Thanks for wathing!
If i try used var_dump(exif_read_data($path)); he return
array(7) {
["FileName"]=>
string(9) "phpv0IOKS"
["FileDateTime"]=>
int(1615462769)
["FileSize"]=>
int(99279)
["FileType"]=>
int(2)
["MimeType"]=>
string(10) "image/jpeg"
["SectionsFound"]=>
string(0) ""
["COMPUTED"]=>
array(4) {
["html"]=>
string(24) "width="960" height="540""
["Height"]=>
int(540)
["Width"]=>
int(960)
["IsColor"]=>
int(1)
}
}
I'm using this library:
https://github.com/amirduran/duranius-paypal-rest-api-php-library
In live mode everything is fine, but when I try to use sandbox I just get: int(35)
$requestParameters = array(
"USER" => $this->username,
"PWD" => $this->password,
"SIGNATURE" => $this->apiSignature,
"METHOD" => $method,
"VERSION" => $this->apiVersion,
);
$requestParameters+=$requestData;
$finalRequest = http_build_query($requestParameters);
$ch = curl_init();
$this->curl=$ch;
$curlOptions=$this->getcURLOptions();
$curlOptions[CURLOPT_POSTFIELDS]=$finalRequest;
curl_setopt_array($ch, $curlOptions);
$serverResponse = curl_exec($ch);
curl_getinfo($ch) result:
array(26) {
["url"]=>
string(37) "https://api-3t.sandbox.paypal.com/nvp"
["content_type"]=>
NULL
["http_code"]=>
int(0)
["header_size"]=>
int(0)
["request_size"]=>
int(0)
["filetime"]=>
int(-1)
["ssl_verify_result"]=>
int(1)
["redirect_count"]=>
int(0)
["total_time"]=>
float(0.228482)
["namelookup_time"]=>
float(0.027594)
["connect_time"]=>
float(0.175784)
["pretransfer_time"]=>
float(0)
["size_upload"]=>
float(0)
["size_download"]=>
float(0)
["speed_download"]=>
float(0)
["speed_upload"]=>
float(0)
["download_content_length"]=>
float(-1)
["upload_content_length"]=>
float(-1)
["starttransfer_time"]=>
float(0)
["redirect_time"]=>
float(0)
["redirect_url"]=>
string(0) ""
["primary_ip"]=>
string(11) "173.0.82.83"
["certinfo"]=>
array(0) {
}
["primary_port"]=>
int(443)
["local_ip"]=>
string(13) "192.168.1.100"
["local_port"]=>
int(53117)
}
If I just change the url to https://api-3t.paypal.com/nvp I'll get a successful or failure response.
I already checked all credentials, cleaned all the cookies, logged in into real and sandbox account and I had used it some months ago without any issue.
Thank you!
Apparently the problem was with openssl version.
I solved it by installing the last version of Mamp (4.1.1) with php 7.1 on my computer and changing the version of php on the server also. Everything working now! ^.^
I have contact form 7 in my website and I am using WP-SMTP plugin to send form data to my gmail account.
I have followed all the steps mentioned in the plugin.
and in Functions.php I have added the following code.
/*Send email*/
add_action( 'phpmailer_init', 'my_phpmailer_init' );
function my_phpmailer_init( PHPMailer $phpmailer ) {
$phpmailer->Host = 'smtp.gmail.net';
$phpmailer->Port = 465; // could be different
$phpmailer->Username = 'alisda.residency#gmail.com'; // if required
$phpmailer->Password = *******; // if required
$phpmailer->SMTPAuth = true; // if required
$phpmailer->SMTPSecure = 'ssl'; // enable if required, 'tls' is another possible value
$phpmailer->IsSMTP();
}
but I receive the following error
Test Message Sent
The result was:
bool(false)
The full debugging output is shown below:
object(PHPMailer)#1551 (76) {
["Version"]=>
string(6) "5.2.22"
["Priority"]=>
NULL
["CharSet"]=>
string(5) "UTF-8"
["ContentType"]=>
string(10) "text/plain"
["Encoding"]=>
string(4) "7bit"
["ErrorInfo"]=>
string(82) "SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting"
["From"]=>
string(26) "alisda.residency#gmail.com"
["FromName"]=>
string(9) "My Alisda"
["Sender"]=>
string(0) ""
["ReturnPath"]=>
string(0) ""
["Subject"]=>
string(50) "WP Mail SMTP: Test mail to shivanand3939#gmail.com"
["Body"]=>
string(68) "This is a test email generated by the WP Mail SMTP WordPress plugin."
["AltBody"]=>
string(0) ""
["Ical"]=>
string(0) ""
["MIMEBody":protected]=>
string(69) "This is a test email generated by the WP Mail SMTP WordPress plugin.
"
["MIMEHeader":protected]=>
string(369) "Date: Fri, 27 Jan 2017 05:13:00 +0000
To: shivanand3939#gmail.com
From: My Alisda
Subject: WP Mail SMTP: Test mail to shivanand3939#gmail.com
Message-ID:
X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
"
["mailHeader":protected]=>
string(0) ""
["WordWrap"]=>
int(0)
["Mailer"]=>
string(4) "smtp"
["Sendmail"]=>
string(18) "/usr/sbin/sendmail"
["UseSendmailOptions"]=>
bool(true)
["PluginDir"]=>
string(0) ""
["ConfirmReadingTo"]=>
string(0) ""
["Hostname"]=>
string(0) ""
["MessageID"]=>
string(0) ""
["MessageDate"]=>
string(31) "Fri, 27 Jan 2017 05:13:00 +0000"
["Host"]=>
string(14) "smtp.gmail.net"
["Port"]=>
int(465)
["Helo"]=>
string(0) ""
["SMTPSecure"]=>
string(3) "ssl"
["SMTPAutoTLS"]=>
bool(true)
["SMTPAuth"]=>
bool(true)
["SMTPOptions"]=>
array(0) {
}
["Username"]=>
string(26) "alisda.residency#gmail.com"
["Password"]=>
**********
["AuthType"]=>
string(0) ""
["Realm"]=>
string(0) ""
["Workstation"]=>
string(0) ""
["Timeout"]=>
int(300)
["SMTPDebug"]=>
bool(true)
["Debugoutput"]=>
string(4) "echo"
["SMTPKeepAlive"]=>
bool(false)
["SingleTo"]=>
bool(false)
["SingleToArray"]=>
array(0) {
}
["do_verp"]=>
bool(false)
["AllowEmpty"]=>
bool(false)
["LE"]=>
string(1) "
"
["DKIM_selector"]=>
string(0) ""
["DKIM_identity"]=>
string(0) ""
["DKIM_passphrase"]=>
string(0) ""
["DKIM_domain"]=>
string(0) ""
["DKIM_private"]=>
string(0) ""
["DKIM_private_string"]=>
string(0) ""
["action_function"]=>
string(0) ""
["XMailer"]=>
string(0) ""
["smtp":protected]=>
object(SMTP)#1552 (14) {
["Version"]=>
string(6) "5.2.22"
["SMTP_PORT"]=>
int(25)
["CRLF"]=>
string(2) "
"
["do_debug"]=>
bool(true)
["Debugoutput"]=>
string(4) "echo"
["do_verp"]=>
bool(false)
["Timeout"]=>
int(300)
["Timelimit"]=>
int(300)
["smtp_transaction_id_patterns":protected]=>
array(3) {
["exim"]=>
string(21) "/[0-9]{3} OK id=(.*)/"
["sendmail"]=>
string(29) "/[0-9]{3} 2.0.0 (.*) Message/"
["postfix"]=>
string(35) "/[0-9]{3} 2.0.0 Ok: queued as (.*)/"
}
["smtp_conn":protected]=>
bool(false)
["error":protected]=>
array(4) {
["error"]=>
string(0) ""
["detail"]=>
string(0) ""
["smtp_code"]=>
string(0) ""
["smtp_code_ex"]=>
string(0) ""
}
["helo_rply":protected]=>
NULL
["server_caps":protected]=>
NULL
["last_reply":protected]=>
string(0) ""
}
["to":protected]=>
array(1) {
[0]=>
array(2) {
[0]=>
string(23) "shivanand3939#gmail.com"
[1]=>
string(0) ""
}
}
["cc":protected]=>
array(0) {
}
["bcc":protected]=>
array(0) {
}
["ReplyTo":protected]=>
array(0) {
}
["all_recipients":protected]=>
array(1) {
["shivanand3939#gmail.com"]=>
bool(true)
}
["RecipientsQueue":protected]=>
array(0) {
}
["ReplyToQueue":protected]=>
array(0) {
}
["attachment":protected]=>
array(0) {
}
["CustomHeader":protected]=>
array(0) {
}
["lastMessageID":protected]=>
string(58) ""
["message_type":protected]=>
string(5) "plain"
["boundary":protected]=>
array(3) {
[1]=>
string(35) "b1_ab0450b0fa3fa25b2fadbefee8bd80f6"
[2]=>
string(35) "b2_ab0450b0fa3fa25b2fadbefee8bd80f6"
[3]=>
string(35) "b3_ab0450b0fa3fa25b2fadbefee8bd80f6"
}
["language":protected]=>
array(19) {
["authenticate"]=>
string(35) "SMTP Error: Could not authenticate."
["connect_host"]=>
string(43) "SMTP Error: Could not connect to SMTP host."
["data_not_accepted"]=>
string(30) "SMTP Error: data not accepted."
["empty_message"]=>
string(18) "Message body empty"
["encoding"]=>
string(18) "Unknown encoding: "
["execute"]=>
string(19) "Could not execute: "
["file_access"]=>
string(23) "Could not access file: "
["file_open"]=>
string(33) "File Error: Could not open file: "
["from_failed"]=>
string(35) "The following From address failed: "
["instantiate"]=>
string(36) "Could not instantiate mail function."
["invalid_address"]=>
string(17) "Invalid address: "
["mailer_not_supported"]=>
string(25) " mailer is not supported."
["provide_address"]=>
string(54) "You must provide at least one recipient email address."
["recipients_failed"]=>
string(45) "SMTP Error: The following recipients failed: "
["signing"]=>
string(15) "Signing Error: "
["smtp_connect_failed"]=>
string(22) "SMTP connect() failed."
["smtp_error"]=>
string(19) "SMTP server error: "
["variable_set"]=>
string(30) "Cannot set or reset variable: "
["extension_missing"]=>
string(19) "Extension missing: "
}
["error_count":protected]=>
int(2)
["sign_cert_file":protected]=>
string(0) ""
["sign_key_file":protected]=>
string(0) ""
["sign_extracerts_file":protected]=>
string(0) ""
["sign_key_pass":protected]=>
string(0) ""
["exceptions":protected]=>
bool(true)
["uniqueid":protected]=>
string(32) "ab0450b0fa3fa25b2fadbefee8bd80f6"
}
The SMTP debugging output is shown below:
2017-01-27 05:13:00 Connection: opening to ssl://smtp.gmail.net:465, timeout=300, options=array (
)
2017-01-27 05:13:00 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known
2017-01-27 05:13:00 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): unable to connect to ssl://smtp.gmail.net:465 (php_network_getaddresses: getaddrinfo failed: Name or service not known)
2017-01-27 05:13:00 SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
2017-01-27 05:13:00 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
I have also tried WP Gmail SMTP Plugin but again there is an error while sending emails.
Thank you for your help!
kindly check following setting in you SMTP setting page in admin:
- Mailer: Send all WordPress emails via SMTP.
- Encryption: Use SSL encryption.
- Authentication: Yes: Use SMTP authentication.
Then try test email.
Hope it will works for your code.
I have some troubles with a custom written API.
It happens when I do an API call, it randomly returns nothing. This is now temporary fixed by doing the same API call until something is returned.
The API calls are always the same and the code itself (SDK and API) does not throw any errors.
I'm thinking of a connection problem?
Is there anyone who has an idea how to fix this properly?
SDK Code:
function doGetRequest($request, $params = array()) {
$request = 'http://www.xxx.be/api/nl/'.$request.'?'.http_build_query($params);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $request,
));
$resp = curl_exec($curl);
curl_close($curl);
return json_decode($resp);
}//doGetRequest
API Code:
public function getCompanyIdByUserId($userId) {
$sql = '
SELECT
company_member_company_id
FROM
ka_company_members
WHERE
company_member_member_id = ?
';
return db::getValue($sql, $userId);
}//getCompanyIdByUserId
Curl_info gives me this when there's nothing returned
["url"] => string(123) "http://xxx/nl/urldata/mijn_webcasts/43?key=xxx"
["content_type"]=>
string(29) "text/html; charset=iso-8859-1"
["http_code"]=>
int(500)
["header_size"]=>
int(199)
["request_size"]=>
int(154)
["filetime"]=>
int(-1)
["ssl_verify_result"]=>
int(0)
["redirect_count"]=>
int(0)
["total_time"]=>
float(0.005005)
["namelookup_time"]=>
float(1.4E-5)
["connect_time"]=>
float(4.8E-5)
["pretransfer_time"]=>
float(7.5E-5)
["size_upload"]=>
float(0)
["size_download"]=>
float(603)
["speed_download"]=>
float(120479)
["speed_upload"]=>
float(0)
["download_content_length"]=>
float(603)
["upload_content_length"]=>
float(0)
["starttransfer_time"]=>
float(0.004986)
["redirect_time"]=>
float(0)
["redirect_url"]=>
string(0) ""
["certinfo"]=>
array(0) {
}
}
I'm at a certain time researching how to make the publication on twitter via programming, but until then I got the code I will show below, only that even with everything set up correctly still not sending, does anyone have any suggestions for settings I must be forgetting to do so sending is completed?
Remembering that I'm using the TwiterrOAuth Abraham Williams, already applied for the 1.1 API. (Latest version of GIT)
Below is the code.
<?php
// Insert your keys/tokens
$consumerKey = 'CONSUMER';
$consumerSecret = 'CSECRET';
$OAuthToken = 'TOKEN';
$OAuthSecret = 'TSECRET';
// Full path to twitterOAuth.php (change OAuth to your own path)
require_once('twitteroauth.php');
// create new instance
$tweet = new TwitterOAuth($consumerKey, $consumerSecret, $OAuthToken, $OAuthSecret);
// Your Message
$message = "This is a test message.";
// Send tweet
$tweet->post('statuses/update', array('status' => "$message"));
?>
Have researched in several posts here on the site and brought me no solution to my problem. Remembering that you are not returning anything, just nothing happens.
My application is setup as read and write on Twitter.
The $tweet->post return false if i check it.
This is what var_dump($tweet) returns
object(TwitterOAuth)#1 (13) {
["http_code"]=> int(0)
["url"]=> string(48) "https://api.twitter.com/1.1/statuses/update.json"
["host"]=> string(28) "https://api.twitter.com/1.1/"
["timeout"]=> int(30)
["connecttimeout"]=> int(30)
["ssl_verifypeer"]=> bool(false)
["format"]=> string(4) "json"
["decode_json"]=> bool(true)
["http_info"]=> array(20) {
["url"]=> string(48) "https://api.twitter.com/1.1/statuses/update.json"
["content_type"]=> NULL
["http_code"]=> int(0)
["header_size"]=> int(0)
["request_size"]=> int(0)
["filetime"]=> int(-1)
["ssl_verify_result"]=> int(0)
["redirect_count"]=> int(0)
["total_time"]=> float(30.02972)
["namelookup_time"]=> float(0.058814)
["connect_time"]=> float(0)
["pretransfer_time"]=> float(0)
["size_upload"]=> float(0)
["size_download"]=> float(0)
["speed_download"]=> float(0)
["speed_upload"]=> float(0)
["download_content_length"]=> float(-1)
["upload_content_length"]=> float(-1)
["starttransfer_time"]=> float(0)
["redirect_time"]=> float(0) }
["useragent"]=> string(25) "TwitterOAuth v0.2.0-beta2"
["sha1_method"]=> object(OAuthSignatureMethod_HMAC_SHA1)#2 (0) { }
["consumer"]=> object(OAuthConsumer)#3 (3) {
["key"]=> string(22) "uqZ5yUGoofxxxxxxxxxxx"
["secret"]=> string(40) "fGpJERhrIAB9RIyQEExxxxxxxxxxx"
["callback_url"]=> NULL
}
["token"]=> object(OAuthConsumer)#4 (3) {
["key"]=> string(50) "49596683-Sxxxxxxxxxxxxxxxxxx"
["secret"]=> string(40) "v3Q6pAeE4t1YXaGxxxxxxxxxxxxxx"
["callback_url"]=> NULL
}
}
The $host variable.
public $host = "https://api.twitter.com/1.1/";
Try adding ..
$tweet = new TwitterOAuth($consumerKey, $consumerSecret, $OAuthToken, $OAuthSecret)
$tweet->get('account/verify_credentials'); //<--- Add this.