Initiate call automatically using tel in Href - php

I am trying to call via Html.I have tried this
<a href='+2000000200200'>Please Click to Call</a>
Now when I click on this , it opens the the dialer having this number and then I press call and it initiates the call.
Now the thing I am trying to do is When I click the link , it automatically initiate the call.I mean the step of Dialler open and pressing call must be skip.So whenever I click the link it should start making call
Is it possible to do like this?I Really need experts advice about this
Thanks

Sorry is not possible and is inteend to be that way. Making the call needs a 3rd application and ofc you wouldnt want anyone making calls or even by mistake a call being made by just clicking.

You can write a custom protocol handler for this type of thing, but the handler obviously needs to be installed on the machine using it.
Check this stackoverflow thread for custom protocol handling in ios and android.
Custom protocol handling windows
Using C#, register registry keys:
RegistryKey Key = Registry.ClassesRoot.CreateSubKey("test");
Key.CreateSubKey("DefaultIcon").SetValue("", "caller.exe,1");
Key.SetValue("", "call:Protocol");
Key.SetValue("URL Protocol", "");
Key.CreateSubKey(#"shell\open\command").SetValue("", "caller.exe %1");
Caller.exe being your handler:
using System;
using System.Collections.Generic;
using System.Text;
class Program
{
static void Main(string[] args)
{
// args[0] contains the phone number
}
}
Finally:
Call Number

Related

Codeception acceptance check if js function is called

i'm trying to create a php test to check if a specific ajax is executed, but i can't find anything that can help me.
I'm fine even if i can check if the method, whom triggers the ajax request, is called (but i think is not possibile to mock js functions with codeception).
A little example to explain better:
let's assume i have my online page: http://example.com with the following js
var log = {
execute: function(){
// AJAX CALL HERE
}
};
log.execute();
With the test i would like to know if log.execute() is executed, so in codeception i can do something like:
$I = new AcceptanceTester($scenario);
// Opening page
$I->amOnUrl('http://example.com');
// Checking if log is invoked
$I->wantTo('Check if log is invoked');
// Something to understand if a method is executed
$I->???('log.execute()');
Otherwise, i'm fine if there is a method to take the browser network activity and then regex it (do not suggest proxy, don't wanna go there).
I'm open to any kind of solutions, even to use a different testing system (with php)
Edit: i forgot to say that i'm using selenium with chromeDrivers
Thanks for your time

Deep linking an app in PHP is not working

I have a webpage that needs to check to see if an app exists using a deep link, but it doesn't seem to work like it should. I have tried the following things.
Using a redirect in PHP (Doesn't work)
header('Location: exampleapp://param=test');
Using a redirect using JavaScript (Doesn't work)
var appurl = 'exampleapp://param=test';
var appstore = 'https://itunes.apple.com/us/app/...';
var timeout;
function preventPopup() {
clearTimeout(timeout);
timeout = null;
window.removeEventListener('pagehide', preventPopup);
}
function startApp() {
window.location = appurl;
timeout = setTimeout(function(){
if(confirm('You do not seem to have the App installed, do you want to go download it now?')){
document.location = appstore;
}
}, 100);
window.addEventListener('pagehide', preventPopup);
}
// app start is then called in the onload
Same as above but replace the the line window.location = appurl; with document.getElementById('deeplink').click(); and adding a link in the html's webpage. (Works) <a id="deeplink" href="exampleapp://param=test">Deep Link</a>
Is there a reason why you can't redirect using a header in PHP?
The PHP version doesn't work, because of the way HTTP works. The HTTP protocol doesn't specify that it should work to redirect to a different protocol from within the "Location:" header. There is nothing specific to PHP here, it's a HTTP issue.
The Javascript version doesn't work because you wanted to set the windows location. And the window cannot show the contents of "exampleapp://..." . You want the link to open like when the user clicks on it. Instead of using window.location you may use document.location.href. That should work.
Another problem:
in your code you write exampleapp:// in 1) and 2). And in 3) you write testapp:// - make sure you use the same URL in all three cases, so that you can be sure that the URL can work eventually..
The answer is to use Apples implementation called 'Smart Banners'
<meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">
You can include three comma-separated parameters in the content
attribute:
app-id: (Required.) Your app's unique identifier. To find your app ID
from the iTunes Link Maker, type the name of your app in the Search
field, and select the appropriate country and media type. In the
results, find your app and select iPhone App Link in the column on the
right. Your app ID is the nine-digit number in between id and ?mt.
affiliate-data: (Optional.) Your iTunes affiliate string, if you are
an iTunes affiliate. If you are not, find out more about becoming an
iTunes affiliate at http://www.apple.com/itunes/affiliates/.
app-argument: (Optional.) A URL that provides context to your native
app. If you include this, and the user has your app installed, she can
jump from your website to the corresponding position in your iOS app.
Typically, it is beneficial to retain navigational context because: If
the user is deep within the navigational hierarchy of your website,
you can pass the document’s entire URL, and then parse it in your app
to reroute her to the correct location in your app. If the user
performs a search on your website, you can pass the query string so
that she can seamlessly continue the search in your app without having
to retype her query. If the user is in the midst of creating content,
you can pass the session ID to download the web session state in your
app so she can nondestructively resume her work. You can generate the
app-argument of each page dynamically with a server-side script. You
can format it however you'd like, as long as it is a valid URL.
https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html

Call php file from metro application

I am currently in the process of creating a windows 8 application using C# and I need to access a php file from a website which has a function loginUser($userParam, $passParam) that handles user login into a database. Any hints on how this can be done? Should I use HttpRequest or is there another method?
You need to pass $userParam and $passParam via GET or POST query and call this function in your PHP script, like
echo loginUser($_REQUEST['userParam'], $_REQUEST['passParam']);
You can make GET or POST request with WebRequest, for example:
http://msdn.microsoft.com/en-us/library/0aa3d588%28v=vs.110%29.aspx

Agile toolkit : how to automatically reload grid

Using Agile toolkit to generate a grid, I'm trying to get an automatic reload of a grid but I can't figure how :/
I dug into the js() function and saw the first parameter is $when but, how to set up an interval?
Reload on event like button click is ok, but I need to set up reload every x sec.
OK here is complete tested example how you should do.
First I have to admit, that ATK4 had no setInterval and clearInterval functions added in univ() library, but already had setTimeout. I added setInterval and clearInterval and made pull request in Github (https://github.com/atk4/atk4/pull/173). I hope Romans will accept that, but if not, then you can always add these functions in your own JS library.
So here is the code:
$g = $this->add('Grid');
$this->js(true)->univ()->setInterval(
$g->js()->reload()->_enclose()
,3000);
Or you can even execute multiple independent functions like this:
$this->js(true)->univ()->setInterval(
$g->js(null,array(
$g->js()->reload(),
$g->js()->univ()->successMessage('Reloaded...')
))->_enclose()
,3000);
Key part here is ->_enclose() method which will convert your JS chain to anonymous JS function.
Javascript code :
setInterval("func()",1000);
This will call the func() function every 1000 ms

How can I implement jquery in my Zend Framework application in a custom manner?

How can I implement jquery in my Zend Framework application in a custom manner.
appending jquery.js ok
appending script ok
send POST data to controller ok
process POSTed data ok
send 'AjaxContext' respond to client now ok (thanks)
I'm using jquery for the first time, what am I doing wrong?
Early on, the best practice to get Zend to respond to ajax requests without the full layout was to check a variable made available via request headers. According to the documentation many client side libraries including jQuery, Prototype, Yahoo UI, MockiKit all send the the right header for this to work.
if($this->_request->isXmlHttpRequest())
{
//The request was made with via ajax
}
However, modern practice, and what you're likely looking for, is now to use one of two new helpers:
ContextSwitcher
AjaxContent
Which make the process considerably more elegant.
class CommentController extends Zend_Controller_Action
{
public function init()
{
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('view', 'html')
->initContext();
}
public function viewAction()
{
// Pull a single comment to view.
// When AjaxContext detected, uses the comment/view.ajax.phtml
// view script.
}
Please Note: This modern approach requires that you request a format in order for the context to be triggered. It's not made very obvious in the documentation and is somewhat confusing when you end up just getting strange results in the browser.
/url/path?format=html
Hopefully there's a workaround we can discover. Check out the full documentation for more details.
Make sure your using $(document).ready() for any jQuery events that touch the DOM. Also, check the javascript/parser error console. In Firefox it's located in Tools->Error Console. And if you don't already have it installed, I would highly recommend Firebug.
This should have been a comment, can't, yet...
It has nothing to do with ZF+Jquery combination.
First try a proto of what you need with a simple php file. No framework, just Jquery and straight forward, dirty php.
Oh, and don't forget to track what happens with FireBug.

Categories