Hello I have build application using codeigniter,
where i create one folder inside controllers like api.
it has few files like api/controller.php, api/user.php
i echo json from the all api controllers.
now i have to do some change with the json which is pass to api from one place.
it is not feasible to got to every controller and each function to so this change.
is there is any way like from any core file or anything where i can do code and it will be proceed before the api receive the output.
rg.
Get Attendee API :
current response : {success:true,attendeeList:{list of attendees}}
now i have to change every reponse like
{succss:true,data:{success:true,attendeeList:{list of attendees}} }
Hello I Have solved this by using $hook['display_override'];
enter image description here
Related
I know that this api is working to get images but how about videos?
https://www.instagram.com/username/?__a=1
I was able to get the thumbnail of the video but not the source or the url itself.
When you make above API call it would return code in it. looks something like this: BWhyIhRDBCw
Whenever your media nodes has "is_video": true you can make following call:
https://www.instagram.com/p/{code}/?__a=1
for e.g.,
https://www.instagram.com/p/BWhyIhRDBCw/?__a=1
This would return another json. which will have video_url you are looking for.
sample:
"video_url": "https://scontent-bom1-1.cdninstagram.com/vp/437699b67172f450331fa732f0777b18/5A7FE0A0/t50.2886-16/20138822_486349355081174_1539674401849475072_n.mp4",
This url working in local machine but not on my remote server.
When i try to hit from remote server its returning html content.
To hit this api simply use volly library it will return json then u can parse json as per your need.
I am tasked to create a web service call where the input looks like this:
<own:AuthenticateMember>
<own:request>
<own1:SecurityToken>9415CD31-0C7E-40AB-A45F-D3538B98D96D</own1:SecurityToken>
<own2:MembershipNumber>200103407801</own2:MembershipNumber>
</own:request>
</own:AuthenticateMember>
The actual values (SecurityToken and MembershipNumber) are PHP request variables.
As you see, it contains namespaces. How would I go about successfully creating this xml request via PHP Soap? Please help me.
I'm from ASP.NET MVC background and this is first time I'm trying to write something in PHP.
In ASP.NET MVC we can develop models for our data and using the actions that we write we can get them or send them to another action. What I mean is that
public ActionResult Login_Action(LoginModel _Model) {
// Authenticating the user
return RedirectToAction(X);
}
when calling this the url that is shown in the address bar (in case of using GET, if it is POST nothing will be shown after the page name) will be:
www.WebsiteX.com/Login?Username=something&Password=something
The problem is that I don't even know how search for this in google (like by typing what exactly) because in Microsoft side, these are handled automatically the way I described.
But in case of PHP, how can I get the values in the address bar? do I have to get the actual address and then break the values down into arrays?
I'd appreciate any help.
First of all, this seems to be invalid for me: www.WebsiteX.com/Login?Username=something?Password=something The first parameter need to be ? and the others should be &.
Second: You can get your values of your parameters by accessing the $_GET global array.
Eg. for the username echo $_GET["Username"];
Are you using any framework? You should. And then, the Framework will give you the way to do that. In ASP.NET you use a Framework so do the same in PHP.
With vanille PHP you can get the GET values with $_GET['Username']. But please, use a framework.
I think that the most popular are Laravel and Symfony right now.
Example:
In laravel you can bind a parameter to a variable so you can do something like:
//Url: mywebsite.com/user/1/
Route::get('user/{id}', function($id)
{
return 'User '.$id;
});
Which is similar with the ASP.NET example.
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
I used the code from http://angularjs.org/ (Wire up a Backend)
Here in project.js
angular.module('project', ['firebase']).
value('fbURL', 'https://angularjs-projects.firebaseio.com/').
factory('Projects', function(angularFireCollection, fbURL) {
return angularFireCollection(fbURL);
}).
config(function($routeProvider) {
I used this code in my web page. Instead of https://angularjs-projects.firebaseio.com/ url i want to use my url i.e http://test.com/test.php. But it didn't work.
Also i want to know in my php file in which format the out put should be?
Do you need to echo the content in php file or use the return command? Please give suggestion. I have searched a lot. I couldn't find the solution.
I think in firebase url https://angularjs-projects.firebaseio.com/ they are returning the response from their back-end service. That is why it didn't worked for you even if you changed the URL.
And answer to your second question;
If you make a call to your back-end service its better to have a json response style from your PHP and you don't have to use any return command for that. Instead you should echo your contents.
For example in your PHP file if you are getting the results as an array you can give back the response to the angular application as;
echo json_encode($result_array);
Hope it helps.
I think you should separate backend and frontend and treat them as two separated application. Both apps should communicate with each other by sending ajax request (front) and respone data in json format (backend). In my opinion it's the best way to handle this.