I am doing Push Notification Service for Apple iphone/ipad. i got the server side code from http://code.google.com/p/apns-php/. it is working well.. but i have to implement it in Yii framework.
i have googled it. and got this
https://github.com/shiki/yii-apns
Here i need to set server_certificates_bundle_sandbox.pem, and device token dynamically at run time.I am new to yii..please help me how to use this component..
i have extracted all the files in components folder,and tried the below code.
$obj=new SAPNS();
$obj->providerCertificateFilePath="provider certificate file path";
$obj->rootCertificationAuthorityFilePath="root certificate path";
$obj1=$obj->getPushProvider();
but while calling getPushProvider method,i got the following error.
include(ApnsPHP_Push.php): failed to open stream: No such file or directory
There is no such a file ApnsPHP_Push.php in ApnsPHP folder in my components folder.dont know in which part i did mistake..
the guys has already wrapped up everything in a component, so you just need to put all the things in components directory and call the desired functions.
if you look at SAPNS.php its got a public property
$providerCertificateFilePath
and that will be the file path to your PEM file and other
$rootCertificationAuthorityFilePath
for secure certificate (if any).
After giving these values you have to call getPushProvider method that will give you an object for ApnsPHP_Push from here you can call this class normally as you do without framework.
Related
I have a VERY simple PHP code:
<?php
$soap = new SoapClient('https://rev-int.api.us.fleetmatics.com/Vehicle/SageQuest/VehicleService.svc?wsdl', array());
var_dump($soap);
When I copy that URL into my browser it loads just fine, with no redirects or anything:
$soap = new SoapClient('https://rev-int.api.us.fleetmatics.com/Vehicle/SageQuest/VehicleService.svc?wsdl
But when I execute that PHP script I get the following error after a PHP timeout:
Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://rev-int.api.us.fleetmatics.com/Vehicle/SageQuest/VehicleService.svc?wsdl=wsdl0' : failed to load external entity "http://rev-int.api.us.fleetmatics.com/Vehicle/SageQuest/VehicleService.svc?wsdl=wsdl0"
Notice the response URL is http://rev-int.api.us.fleetmatics.com/Vehicle/SageQuest/VehicleService.svc?wsdl=wsdl0 which is very similar but not quite accurate. If I search the working WSDL for that given URL I find it at the top:
That said, every URI points to HTTP instead of HTTPS, but if we simply change this in our browser the page loads just fine.
So the question becomes: when we create a PHP SoapClient, can we force all URIs to follow HTTPS regardless of the protocol specified in the WSDL?
The WSDL can stand by itself and contain everything inside, or it can use imports to bring in content from other locations (it usually happens with XSD schemas).
If it imports things, those imports need to be resolved by the client. If they can't be resolved, either because the location is wrong, or the protocol is wrong, or whatever, then the client bails out, because it needs a complete WSDL to understand the service's contract and how to call it, not just the parts it could load.
So you have two options:
Contact the provider of the service and ask them to fix it so all imports can be resolved.
If you can download the WSDL and all the resources it tries to import, by opening in browser and changing the protocol to https, you can save them all locally on disk in the same folder. Assuming you end up with a file named VehicleService.wsdl for the WSDL itself, and VehicleService.xml for the file you got from http://rev-int.api.us.fleetmatics.com/Vehicle/SageQuest/VehicleService.svc?wsdl=wsdl0 somehow, you can then change the WSDL to import this local file with <wsdl:import .... location="VehicleService.xml" /> instead of what it does right now. Then you can feed this local WSDL to your client, and because now everything is in the same folder, it should work.
I tried to implement the simplesamlphp library into my web application. But when I call the requireAuth() function I get a PHP fatal error message. Uncaught Exception: Loader: Illegal character in filename.....
It seems like he can't resolve the Class SimpleSAML\Module\saml\Auth\Source\SP
But I don't know why.
Does anyone have a idea how to fix this?
I already deleted the whole simplesamlphp installation and reinstalled it.
I use the following code:
require 'var/www/simplesamlphp/lib/_autoload.php';
$lAuthSrc = new \SimpleSAML\Auth\Simple('default-sp');
if (!$lAuthSrc->isAuthenticated()) {
$lAuthSrc->requireAuth();
}
$lAttributes = $lAuthSrc -> getAttributes();
foreach($lAttributes as $lAttribute) {
print_r($lAttribute);
}
Some additional informations:
The configured authentication source test works fine. If I login via the configured authentication source, everything works fine and I don't get any error messages (the requireAuth() function don't get called in this case).
I use the latest version of simplesamlphp v.1.18.3
If you need any more information, please let me know.
Honestly it looks like your path is messed up on the require... are you sure you should be using:
require 'var/www/simplesamlphp/lib/_autoload.php';
and not
require '/var/www/simplesamlphp/lib/_autoload.php';
Do you really have a 'var/www' subdirectory relative to the location of the script? That looks wrong to me. If you include that first / before var it makes that path absolute to the typical install location for SSP.
Thank you all for your help. I discovered this morning the issue. The issue was the autoloader which I use for my own application. I registered the application autoloader in another file which gets executed before the code you see above. And simplesamlphp uses some conditions like:
if (!class_exists($className))
And beacuse I registered my application autoloader before the function class_exists checked if the class exists in my application. In my application I don't use namespaces and this was the issue.
To fix this issue, I unregistered my application autoloader before using the simplesamlphp code and registered the autoloader again after the simplesamlphp code.
I hope this will save some of you headaches.
I am new in Vue.js try to understand vue-socket.io but failed
i used this to install https://github.com/MetinSeylan/Vue-Socket.io and code
import VueSocketio from 'vue-socket.io';
Vue.use(VueSocketio, 'http://xxxxx.local:1923');
in my App.js , i am try to make a transaction socket when ever transaction made its reflect in web socket . i need a example of all files which i have to code or you can say that file structure which file i need and where to place all files.
like import file is done in main.js
test connection is done in Components.vue file
but where to handle my php code (Laravel 5.5) and js server file
please guide me with example links if you have
I used this tutorial to help my with Vue.js. It does not use the Vue-Socket but pusher instead. But the behavior remain the same.
You will see what you need.
Basicaly you have to follow the folowing steps
Setup a broadcast system in config/broadcasting.php
Define your model & controller
Add routes (routes/web.php)
Create your Vues and components
Setup the boradcast and listening events
I've finished a web site that runs on my computer and on the old server. The problem is that the old server is dying and my employer wanted to move it to a new server.
When he moved it, one web page shows me an error:
The autoloader expected class "Equips\FrontendBundle\Helper\LDAPHelper" to be defined in file "/var/www/sinfratic_dev/src//Equips/FrontendBundle/Helper/LDAPHelper.php". The file was found but the class was not in it, the class name or namespace probably has a typo.
and it's like "what?" because I haven't done anything of that part (I just worked with another part of the web). And I've checked that file and inside there is the class "LDAPHelper".
I know what a server LDAP is, but I don't know if that problem is because the new server cannot communicate with out LDAP server or it doesn't have all things installed (I've installed ldap-auth-client, ldap-auth-config, libaprutil1-ldap, libldap-2.4-2, libldap2-dev, libnss-ldap, libpam-ldap and php5-ldap; things that were on the old server but not in the new, but it still doesn't work).
Any idea?
Thanks you so much.
EDIT
Thanks for the comment. Here is the header of the file:
<?
namespace Equips\FrontendBundle\Helper;
class LDAPHelper {
Ok, it was PHP and something unexpected.
By default, short_open_tag is off, so this .php could not be readed properly.
Just needed to put it on in php.ini.
Is there an easy to setup Codeigniter REST library which I can use to consume a RESTful service? I tried setting up this library. But could not set up Spark. Tried following steps:
Adding a directory named sparks in the root of your codeigniter directory
Adding a custom Loader Class to application/core/MY_Loader.php.
It gave me another error Cannot find spark path at sparks/curl/1.2.1/. Now I am stuck. Wondering why it is so hard to setup RESTful API in codeigniter.
Update: When I try to run
$this->load->spark('restclient/2.1.0');
// Load the library
$this->load->library('rest');
// Run some setup
$this->rest->initialize(array('server' => 'http://api.twitter.com/'));
// Pull in an array of tweets
$tweets = $this->rest->get('1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=jenksuy&count=2');
$tweetobjects = json_decode($tweets);
foreach ($tweetobjects['results'] as $tweet) {
log_message('info', $tweet['text']);
}
I am getting Error: Call to undefined method CI_Loader::spark()
sparks is not necessary SEE EDIT. use this tutorial to start, the author also wrote the libraries
http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/
download these two to work with the tutorial:
https://github.com/philsturgeon/codeigniter-restserver
https://github.com/philsturgeon/codeigniter-restclient
also at the end of the tutorial - theres many comments and questions, and the tutorial author has answered many of them
EDIT - whoops forgot you have to change one line. and you will need to DL the CI curl library. OK so in the rest client, in the file Rest.php starting at line 53
/* Not using Sparks? You bloody well should be.
| If you are going to be a stick in the mud then do it the old fashioned way
$this->_ci->load->library('curl');
*/
// Load the cURL spark which this is dependant on
$this->_ci->load->spark('curl/1.2.1');
so change it to load curl library the traditional way and commment out the spark reference
$this->_ci->load->library('curl');
// Load the cURL spark which this is dependant on
// $this->_ci->load->spark('curl/1.2.1');
You can install curl 1.2.1 by running the following command on your application root (not your application folder):
php tools/spark install -v1.2.1 curl
Source