How would I create this with PHP soap? - php

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.

Related

need to some action on the api response codeigniter

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

There is a error in parsing the rss from stackoverflow.com. using SimpleXML in PHP

I was trying to parse the rss of the tag PHP, from http://stackoverflow.com and tried to use something other than DOM Model, So I looked into SimpleXML. THis is my code:
<?php
error_reporting(-1);
$xml = file_get_contents('https://stackoverflow.com/feeds/tag/php');
$loaded = simplexml_load_string($xml) or die("There is a problem");
$str1 = $loaded["entry"]["entry"][0]->title;
echo $str1;
?>
But nothing is displayed on the screen, and also no error is displayed!
The sample data from https://stackoverflow.com/feeds/tag/php can be found at
http://gourabt2.cloudapp.net/sample-data/sample_data.xml
Any Help would be very much appreciated! Thanks! Cheers!
You use array-access in SimpleXML to access attributes so:
$loaded["entry"]
returns the attribute named "entry" from the document element.
use arrow-access to get the element named "entry" instead:
$loaded->entry
this returns the element named "entry".
Additionally take care with namespaces. Parsing a feed with SimpleXML has been outlined already in existing Q&A material, please relate to it.
Try this out.
<?php
$xml = file_get_contents('http://stackoverflow.com/feeds/tag/php');
$loaded = simplexml_load_string($xml) or die("There is a problem");
foreach($loaded->entry as $post) {
echo $post->title . "\n";
}
Output:
join 2 tables - group by id order by date price asc
using php variable in an sql query
Clear browser cache memory by php code
There is a error in parsing the rss from stackoverflow.com. using SimpleXML in PHP
Modify Laravel Validation message response
chained dropdown from database
Php database handling
How to load model with Codeigniter Webservice - Nusoap Server?
multiple report download php adwords api
Unable to confirm Amazon SNS subscription for SES bounces
Comparing if values exist in database
Better way to CURL to WCF
PHP SaaS Facebook app: Host Page Tab ID and User ID
PHP and Mysql - running over PDOStatement
How to change form textbox value in Zend form annotation?
connect Android with PHP, MySQL , unfortunately app has stopped in android emulator
Auto increment a SESSION key ID
Call PHP function in a class from a HTML form
PHP SQL Preventing Duplicate User names: Catching Exception vs Select Query
I am only able to grab the first group of text in between the tr need helping fixing my code
How to run an external program in php
How to connect to php in android using an async task?
PHP Return HTML (Laravel / Lumen Framework)
prestashop smarty if statement
Cakephp OR condition Implementation
Progress bar HTML5/PHP
preg_match file url from jwplayer
Does Cloudflare Cache HTML5 Video Embedded on PHP Page?
how to INSERT INTO JOIN
PHP web service returns "403 forbidden" error
That's because you have the wrong path. Here is the correction.
(string)$loaded->entry->title;

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

angular js with php integration

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.

execute some function in some php file on another server(apache) and get the returned value

I want to access some function written in some php file on another server and receive the input, I have access to those server files so that I can change them for proper configuration, I have all the privilleges to do so, can anybody please guide me how can I do it, thank you
$result = file_get_contents("http://some.server/out.php");
and in this out.php
<?php
include 'some.php';
function();
I think you can implement web service or an api, and the output could be in xml or json read the content and use it on your website.
It is just Facebook graph API using URL
https://graph.facebook.com/Pepsi
The above link will fetch information regarding Facebook page of Pepsi.

Categories