I am using twilio library in codeigniter . I am facing one issue the library does send the sms if its less than 150 character but as the number of character increased it don't send sms .
I searched on twilio website and figure out this
Yes. With the Messages resource URI, you can send messages containing up to 1600 characters. Learn about the Message functionality here. Note: the SMS resource URI is deprecated and does not support >160 characters.
Where as when i see the code of twilio library for codegnitor it has this function .
public function sms($from, $to, $message)
{
$url = '/' . $this->api_version . '/Accounts/' . $this->account_sid . '/SMS/Messages';
$data = array(
'From' => $from,
'To' => $to,
'Body' => $message,
);
if ($this->mode == 'sandbox')
$data['From'] = $this->number;
return $this->_twilio->request($url, 'POST', $data);
}
and from the twilio website its using this
/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}
where as in twillio codeigniter library he has this
'/' . $this->api_version . '/Accounts/' . $this->account_sid . '/SMS/Messages';
Is there a way that I can do changes and I can send more character using twillio Codeigniter library?
ok a simple fix , You just need to change this line of code at line number 78 in libraries/Twilio.php file
$url = '/' . $this->api_version . '/Accounts/' . $this->account_sid . '/SMS/Messages';
to this
$url = '/' . $this->api_version . '/Accounts/' . $this->account_sid . '/Messages';
Related
i am trying to upload image from mobile, with name of the image of it.
i am using flutter for the mobile and using dio to upload it.
but i got error when it upload to laravel server.
here is my code in laravel 9 :
foreach ($request->team as $item) {
$foto = $item->file('id_card');
$path = public_path() . '/upload/idcard/' . Str::slug($workingPermit->id) . Auth::id() . '/images';
$fileName = Str::random(6) . $foto->getClientOriginalName();
$foto->move($path, $fileName);
$workingPermit->tenant_team()->create([
'name' => $item['name'],
// 'id_card' => $item['id_card']
'id_card' => '/upload/idcard/' . Str::slug($workingPermit->id) . Auth::id() . '/images/'. $fileName
]);
}
please help, i really need your help
I need to integrate SMS for different events i.e on customer registration, new order placed, order status change, etc in magento with http sms api provided by sms provider. Please share if anyone have it. I want it to be customized and dont want to use any extension for it.
For Sms you need to purchase sms gateway .they provide their own curl type
api like www.textlocal.com
and api code like
$token="some message";
$username = urlencode($email_id);
$hash = urlencode($secretecode); // Get this when logged in at https://control.txtlocal.co.uk/docs/
// Message details
$numbers = urlencode($mobile_no);
$sender = urlencode('Textlocal');
$message = rawurlencode('Your activation code is :'.$token);
$data = 'username=' . $username . '&hash=' . $hash
. '&numbers=' . $numbers . "&sender=" . $sender . "&message=" . $message;
// Send the GET request with cURL
$ch = curl_init('https://api.txtlocal.com/send/?' . $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
First of all I had my sandbox merchant account configured to receive IPN. I will show you the first half of my codes that is sent to Paypal:
function process() {
$my_email = 'jaylimix-facilitator#hotmail.com';
$item_name = $this->input->post('item_name');
$amount = $this->input->post('amount');
$function = $this->input->post('function');
$return_url = base_url() . 'order/'.$function;
$cancel_url = 'http://cancel.com';
$notify_url = base_url() . 'test';
$querystring .= "?business=" . urlencode($my_email) . "&";
$querystring .= "item_name=" . urlencode($item_name) . "&";
$querystring .= "amount=" . urlencode($amount) . "&";
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$querystring .= "$key=$value&";
}
$querystring .= "return=" . urlencode($return_url) . "&";
$querystring .= "cancel_return=" . urlencode($cancel_url) . "&";
$querystring .= "notify_url=" . urlencode($notify_url);
header('location:https://www.sandbox.paypal.com/cgi-bin/webscr' . $querystring);
}
The customer is redirected to PayPal to complete payment. When the Pay button is clicked, I checked to see if any POST variable is received:
class Test extends CI_Controller{
function index(){
foreach ($_POST as $key => $value) {
echo $key . ' ' . $value . '<br/>';
}
}
}
But there is none received and I do not know where the problem is. Please give your advices, thanks!
When the Pay button is clicked, I checked to see if any POST variable is received:
It isn't. PayPal invokes the notifyURL separately at a later time, not 'when the Pay button is clicked'. When PayPal returns to your site, all you know is that they have been to PayPal. In any case you shouldn't do anything of value for the customer until PayPal tells you that you actually have the money.
I've been a Facebook developer for a while now, but I'm starting fresh with the new Facebook App layout and stuck one of the first steps. So apparently my old method of authentication doesn't work anymore.
To solve this, I tried the one given as an example at http://developers.facebook.com/docs/authentication/ . However, it doesn't seem to work at all on internet explorer.
Here's my code right below:
<?php
$app_id = "-----";
$app_secret = "------";
$my_url = "http://apps.facebook.com/myapp/";
require('facebook-php-sdk-2343fca/src/facebook.php');
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true,));
$session = $facebook->getSession();
session_start();
$code = $_REQUEST["code"];
echo $_REQUEST['state']." == ".$_SESSION['state'];
if(empty($code)) {
$_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection
$dialog_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url) . "&state="
. $_SESSION['state'] . '&scope=publish_stream,read_stream,user_photos,friends_photos,user_events,friends_events';
echo("<script> top.location.href='" . $dialog_url . "'</script>");
}
if($_REQUEST['state'] == $_SESSION['state']) {
$token_url = "https://graph.facebook.com/oauth/access_token?"
. "client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url)
. "&client_secret=" . $app_secret . "&code=" . $code;
$response = file_get_contents($token_url);
$params = null;
parse_str($response, $params);
$graph_url = "https://graph.facebook.com/me?access_token="
. $params['access_token'];
$user = json_decode(file_get_contents($graph_url));
//echo("Hello " . $user->name);
//My app goes here!
} else {
echo("The state does not match. You may be a victim of CSRF.");
}
?>
So far, all I know is the problem has to do with $_SESSION['state'];
Any help would be much obliged!
Hmm, I got it working. It's a quite obscure issue with P3P cookies handling by Internet Explorer with iframes. In short, just put this somewhere in the beginning of your code:
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
You can read more here: How to properly handle session and access token with Facebook PHP SDK 3.0?
Trying to send a PHP email the easy way but I cannot work out why this one does not work. For some reason it sends 3 emails all with their entire content being '1' . That is all.
The PHP
else if (isset($_GET['quoteemail'])) {
$email = include(TEMPLATEPATH . '/bookings/booking-quote.php');
$to = $current_user->user_email;
$subject = "Your Order - Dive The Gap" ;
$message = $email;
$headers = "From: Dive The Gap Bookings <ask#divethegap.com>" . "\r\n" .
"Content-type: text/html" . "\r\n";
mail($to, $subject, $message, $headers);
}
Don't worry about the else if, their is an IF or 2 before this function.
Any ideas,
Marvellous
include, that includes a file and tells you "1" when it successfully includes the file.
You probably want to look into the function: file_get_contents();