PHP - Log Incoming Calls To Web Service
Hello
I am looking for a way to log all incoming requests to a nusoap web service to a file.. any suggestions?
Thanks
Similar TutorialsOkay, On my original problem, I have been able to authenticate with the web service login service, and extract a cookie as follows from the web-service: $s_Cookie = $agLoginService->agGetCookie(); $s_Cookie = AGSESSION=oxhbjcKtPw5sOymAD8m8KcKR6JL4i+TIE5mZxwOrXLwCRr8iTOvPxA==; Now, I create data access soapclient: $agDataService = new SoapClient($s_DataURL, $a_SoapOptions); //yes I know I should build my own class wrapper around soapClient, but I am trying to make sure I know what to build before I do next in the process I need to set the cookie for the data access service. I tried using: <b>$agDataService->__setCookie('cookie', $s_Cookie);</b> but I don't think it's right because when I call any of the service's functions, I get no data back. This is what their engineer had to say ( he is no help in php at all) This is a question referring the http headers. He needs to set the cookies as given in the examples on the wiki page. The cookie is specified in a response http header as: Set-Cookie. So the http headers he got back are correct. The cookie he has to set is AGSESSION=oxhbjcKtPw5sOymAD8m8KcKR6JL4i+TIE5mZxwOrXLwCRr8iTOvPxA==; There should be an api for setting the cookie if not there is one for setting the http header. Set the http header name for the request (cookie - notice that is different than what you get back from an http response - read the rfc spec for http for all of the details) then set the value. The semi colon at the end is the delimiter for http headers (in the rfc). That is all he needs to do if he gets back some login error that means the cookies did not get set correctly. Any ideas or help will be great. Thank you. I am running a godaddy linux server and would like to save the incoming emails into my database. I'm running a Simple Control Panel. This article about intercepting emails is exactly what I want to do. But its not working... http://tinsology.net/2009/01/intercepting-email-with-php/ It looks like there are quite a few pointers online but i haven't found a solution. Thanks in advance. Hello
I have a nusoap web service running, which is fine, but I need to send a new variable in the parameters which decides what database to use...
This is how I call the function:
$params = array( 'region' => '1' ); $response1 = $client->call('function1', array ($params)); // response will be in JSON Ahoy Sailor! So I've just started making a Server Client based application in PHP, First time I've dabble in PHP for about a year so forgive me if I'm slightly rusty. But I get the "Could not accept incoming connection" error when my client try's to connect to my server. How cometh? <?php $host = "127.0.0.1"; $port = 405; set_time_limit(0); // create socket $socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n"); $result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n"); $result = socket_listen($socket, 3) or die("Could not set up socket listener\n"); // Networking area, Creating, Binding & finally listing $spawn = socket_accept($socket) or die("Could not accept incoming connection\n"); $out = "0;text\n"; socket_write($spawn, $out, strlen ($out)) or die("Could not write output\n"); ?> ^ Client<?php $addr="127.0.0.1"; $port=405; $timeout=0; $socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n"); $res = socket_connect($socket, $addr, $port); $spawn = socket_accept($socket) or die("Could not accept incoming connection\n"); $dat= socket_read($spawn, 1024) or die("Could not read input\n"); echo $dat; ?> Server^ _____________________ Anyone know? See Ya! Hey everyone... Been over a year or more since I have had seek help here but I have something that I just do not understand. I am submitting a from from one domain - www.mydomain.com - to a form handler on another domain - www.theirdomain.com all under https. The form data is getting to theridomain.com just fine, the other side is handling it properly and all is well there. The issue is they are taking the response they generate and shipping it out via cURL using the below (they were nice enough to share this with me). Code: [Select] $url = $_SESSION['request']['retUrl']; $fields = array( 'hash'=>rawurlencode($hash), 'responseText'=>rawurlencode($_SESSION['response']['responseText']), 'cid'=>rawurlencode($_SESSION['request']['cid']), 'name'=>rawurlencode($_SESSION['request']['name']), 'actCode'=>rawurlencode($_SESSION['response']['actCode']), 'apprCode'=>rawurlencode($_SESSION['response']['applCode']), 'Token'=>rawurlencode($_SESSION['response']['token']), 'req_number'=>rawurlencode($_SESSION['request']['req_number']), ); foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); if (isset($_SESSION['request']['Address1'])) { $Address = array( 'Address1'=>rawurlencode($_SESSION['request']['Address1']), 'Address2'=>rawurlencode($_SESSION['request']['Address2']), 'City'=>rawurlencode($_SESSION['request'][City']), 'State'=>rawurlencode($_SESSION['request'][State']), 'Zip'=>rawurlencode($_SESSION['request']['Zip']), 'Country'=>rawurlencode($_SESSION['request']['Country']), ); foreach($Address as $key=>$value) { $Address_string .= $key.'='.$value.'&'; } rtrim($Address_string,'&'); } $end = array( 'END'=>"END" ); foreach($end as $key=>$value) { $end_string .=$key.'='.$value; } rtrim($end_string,'&'); I have worked for almost a week and I CANNOT snag the incoming data! All I am trying to do is collect this and convert it into $_SESSION data for use on a success page. If any one has any thoughts or in site, please.... Is there a good way to batch API calls? I'm building a service that requires n^2 api calls for each city I add. Naturally, this is getting a bit clunky (6 cities is 36 separate calls). I lieu of finding a better webservice that can consolidate this into one API call, is there a good way to batch these so I don't get fatal errors when one of these fails? Ideally, I'd be able to loop the calls until results are returned for each. Thanks Hi, Is it possible to return information on a cURL call. for example i want to kind of make my own API for my website cn i make a cURL call to my server and return data back to the client or is cURL just to send data. if cURL is just to send data what is another method to send a request and receive data back on the call? Thanks Mike
I have a script that runs periodically by a launchd timer. I give the script a very tight timeout ( set_time_limit(120); ). Apparently, this is bad. Wish someone would have told me. Sadly, it is too simple. I had Code: [Select] <? $company=mysql_query("select this and that") while($company=mysql_fetch_array($company)) { a bit of output; $properties=mysql_query("Select this and that from properties where company_id=$company['id']") while(properties=mysql_fetch_array()) { what I want to output } } I seem to be missing some understanding of what the heck to do now. Please, please any suggestions. I suck at object orientation, and arrays of arrays of arrays confuse the crap out of me. Am I missing something simple. Am I over-reacting? I have 15 companies, and about 100 properties total. This is my first time messing with SOAP. $params = array( 'user' => 'username@gmail.com', 'password' => 'password', 'keyStr' => $keyStr, 'subId' => $subId); $return_string = $client->call('getKey','getTodaySubIDStats','getYesterdaySubIDStats','getMonthToDateSubIDStats','getLastMonthSubIDStats', $params); The $return_string = $client->call('getKey','getTodaySubIDStats','getYesterdaySubIDStats','getMonthToDateSubIDStats','getLastMonthSubIDStats', $params); spits out Fatal error: Uncaught SoapFault exception: [Client] Function ("call") is not a valid method for this service in /home/site82/public_html/stats.php:20 Stack trace: #0 /home/site82/public_html/stats.php(20): SoapClient->__call('call', Array) #1 /home/site82/public_html/stats.php(20): SoapClient->call('getKey', 'getTodaySubIDSt...', 'getYesterdaySub...', 'getMonthToDateS...', 'getLastMonthSub...', Array) #2 {main} thrown in /home/site82/public_html/stats.php on line 20 So I E-Mailed support and got this Quote There are two different ways to make SOAP API calls, depending on which PHP library you use. The example in the document has a client which wants calls like this: $client->call('funcname', parm1, parm2) The other type of call, which I think your client is using, is like this: $client->funcname(parm1, parm2) Switch over your coding and that should eliminate the problem you are getting. so I tried... $return_string = $client->getTodaySubIDStats(user,password,keyStr,subId); and it then spits out Fatal error: Uncaught SoapFault exception: [HTTP] Internal Server Error in /home/site82/public_html/stats.php:17 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://www.maxb...', '', 1, 0) #1 /home/site82/public_html/stats.php(17): SoapClient->__call('getTodaySubIDSt...', Array) #2 /home/site82/public_html/stats.php(17): SoapClient->getTodaySubIDStats('user', 'password', 'keyStr', 'subId') #3 {main} thrown in /home/site82/public_html/stats.php on line 17 How do I call it the correct way?? http://pastebin.com/DbHQSYd7 Been stumbling my way through OOP and seem to be understanding it for the most part (I think..) But I've got a couple questions / kinks that I can't seem to work out. a) How do I return a variable from a class so that a different class has access to it (meta_data) b) I'm getting a "$this" cannot be redefined error (which I know why, but I don't know how to fix)) c) How do I call a function from within one class, where the function resides in another class, AND pass it variables? Any help would be greatly appreciated I've tried to Google warrior A and I think I can figure that one out, but B and C are proving to be the real stumbling blocks. Hi, I am trying to output my data call rows, alongside each other till two, then break and start a new row. and so on and so on. this is not really a example question, i think its more a request information question and example question. How would i go about $outputting the rows alongside each other? i have tried: $output_rows['MYDATA']='then in here i have had a complete table with all the css and styling and information entered'; //but i couldn't get it alongside each other on the html page? then i tried outputting the information and had the tables and css setup on the .html page, but that gave me duplicate entries alongside each other, as no i was entering data from the {MYDATA}.. Twice.. I am really stuck! if any one can assist Great. I have this code that has Code: [Select] $this->BeginTransaction();all over it. These are in classes where no such function is defined, and they don't have parents either. It's driving my crazy trying to figure out why they are there, why there's not so much as a warning being given and what, if anything, is being called. Now I do have a Code: [Select] set_error_handler("amfErrorHandler");and in amfErrorHandler I have Code: [Select] if( error_reporting() != 0 && ($amfphpErrorLevel | $level) == $amfphpErrorLevel ) { throw new VerboseException($string, $level, $file, $line); } I don't remember what $amfphpErrorLevel is, except that it should only be ignoring things like E_STRICT. Also, no exception is being thrown. So what do I do w/this code? Trying to get this done: Page_1 has many external links, when certain links are clicked i do not want user to go directly to page, but rather go to a special add page_2 where user must click a second time on the link to finally get there. The add page_2 must show on screen the name of the initial link from page_1, it must change accordingly with the link it came from page_1,once on page_2 the hyperlink redirects outside the site. So far i am thinking give an id to the div or "<a href..." on page_1 then somehow have page_2 detect that id and fill in the variable for the final external link. Other wise is there a way to detect a url from incoming? I guess a similar example is how some domain name sellers landing page will indicate the name of the site. Such as "Thisdomain.com" is for sale. same landing page but the name changes according to the domain that was typed. I need to debug a php program. I've tried to use something like: $debuginfo = var_dump(debug_backtrace()); and then write $debuginfo to a text file for later review. The problem I have is that this approach uses the output stream and my program also wants to write to the output stream. Unfortunately, other programs are using the output stream and dumping dignostic data to the outputstream mesess with the state of the program. Is there a way to get a snapshot of variables and calls without interfering with the output stream? Thanks Mike but never on the first call. Okay, I posted this on StackOverflow but no one there seems to have an answer either. I have this simple function: Code: [Select] public function delete($messageID) { $type = $this->findType($messageID); if ($type == 'in') { foreach ($this->inArr as $key => $value) { if ($this->inArr[$key]->messageID != $messageID) $implodeData[$key] = $this->inArr[$key]->messageID; } if (!isset($implodeData)) $imploded = '0'; else $imploded = implode(',', $implodeData); $result = $this->_database->updatePMUser('inArr', $imploded, 'UID', $this->UID); $result2 = $this->_database->deletePM('messageID', $messageID); return; } else { foreach ($this->sentArr as $key => $value) { if ($this->sentArr[$key]->messageID != $messageID) $implodeData[$key] = $this->sentArr[$key]->messageID; } if (!isset($implodeData)) $imploded = '0'; else $imploded = implode(',', $implodeData); $result = $this->_database->updatePMUser('sentArr', $imploded, 'UID', $this->UID); $result2 = $this->_database->deletePM('messageID', $messageID); return; } } It is a delete function for a private messaging program for a forum script I'm writing. Anyway, here's the issue - it works! But only sometimes. It is called in 3 different places, always from a form processing class I have, once in the view message section to delete a message you're viewing, in a foreach from the sentbox options section and then a foreach in the inbox options section. The inbox and sentbox option sections do that whole "delete the checked messages" for the mass removal functionality. The delete function above works in all ways shapes and forms when I use it in single calls - like when I'm deleting a message while viewing it or when I only check one message from the inbox, etc - but when I call it multiple times (as in I have checked multiple messages) - it fully deletes one (both the message and the reference to the message in the user's db row) and then only deletes the actual message on the others (deleting the message is the call to deletePM - deleting the reference is the call to updatePMUser). Okay, if you need further information - the function above checks the type the message is (in the inbox or in the sentbox) and then uses that to foreach through that array (inArr or sentArr) of the user. It logs in all the messageIDs of the those that DON'T match the one we're deleting and then at the end it implodes those caught IDs into a string that is then updated in the user's row as a comma separated string of values each representing a message in the DB - you get the picture. I realize I have some trimming to do (for one I can cut the above function down by about half by using variable variables) but I'll get to that after I get the thing working. I can't figure out why it's doing what it's doing. If you need the function that calls this in the foreach, I have it below. Oh, and the thing that really boggles me is that this function is called fully for each checked message in the foreach - it fully returns and then loops - if it works once, I don't see how it wouldn't work on a second call from a loop - the variables it uses should be trashed when it leaves the function, they aren't global or object properties or anything. Color me confused. Thanks for any help, oh, here's one of the functions that calls it to delete checked messages (this one is for the sentbox, there is another for the inbox): Code: [Select] private function _processSelectedSent() { $pmObj = unserialize(base64_decode($_POST['pmObj'])); $i=1; foreach ($_POST as $key => $value) { if ($value == 'marked') { $checkedArray[$i] = $key; $i++; } } if ($_POST['submitter'] == 'Delete Selected') { if (is_array($checkedArray)) { foreach ($checkedArray as $key => $value) $pmObj->delete($value); } else $pmObj->delete($checkedArray[1]); header("Location: ".HOME_PAGE.PM_PAGE."?view=sentbox&nocache=".time()); } } I'm getting the following result from a web service call. I'd like to pass it to another page, possibly using sessions, and then access specific values on that page, such as FirstName.
stdClass Object ( [GetProspectAsJSONResult] => [ { "ProspectId": xxxxxx, "Keycode": "Test", "FirstName": "Test", "LastName": "Test", "Company": "Test","Email": null } ] )
I'm not sure what the best way to do this is.
Thanks!
I everyone, I'm developing a small MVC framework for my personal work, now, in order to have access from all the classes to certain variables I've created a registry class, for this to work I have 2 options: 1.- passing every time the registry object to the constructor class(controllers, models, etc) or 2.- create in the registry static set and get so I can reach the variables by Registry::set(name, value) and Registry::get(name) My question is, which one of this two options takes less resources(is faster)? I hope anyone can help me with this, thanks in advance Hi Guys/Gals, I am new to PHP and when I say new, I mean I know a variable is $variable name... that is about it. I am a .Net developer, always was, now I have to learn some php. I have a .Net payment gateway service that I would like to reference from a php site. I was hoping anyone could point me in the right direction on how to go about adding a .Net Service and pointing to it in PHP. Please note this is a WPF service, thus it is a .svc page not a .asmx and it is hosted and running on iis on a server. Please some guidance? Any help would be appreciated. Hi, guys. I just developed and published first version of 12framework for iOS which can call also PHP web services.
It is web service client which generates dynamic forms from web service results, and enables insert, update and delete of records. You can simply change result field type to text, memo, date, bool.
I also made some simple PHP web service to test functionallity of application, so I will really appreciate your feedback. iOS is locked platform, so 12framework provides possibility, to make some useful data forms that works as native application. Link: https://itunes.apple...88083?ls=1&mt=8
|