Repeating same name parameters with nusoap

This article assumes you have a background with nusoap. Start by reading a nusoap tutorial or two, suggest http://www.zend.com/zend/tut/tutorial-campbell.php and http://www.scottnichol.com/nusoapprogwsdl.htm

I’m going to setup a soap server to except parameters. The method will do something silly, the point is to understand how to make a client with nusoap, when the server excepts repeating, same name parameters. This came up for me recently, and I struggled with it for hours, never did find a good explaination of it online, so I’m writing this for the next guy.

Read the rest of this entry »

Paypal API issues, using PHP5 and nusoap

Posted 1 year, 6 months ago on August 27, 2006 by dave #

Back in Aug 2005, I found something wrong with the http://www.paypal.com/wsdl/PayPalSvc.wsdl file, it’s still a problem!

I have a really interesting situation trying to retrieve order information from Paypal. I compiled PHP 5.0.4 –with-soap thinking that I would just use the built in Soap implemention that comes with PHP5. So, I start with PayPal’s GetTransactionDetails API call. It didn’t work because the service address location defined in the production WSDL has the sandbox URL in it. I complained about this to Paypal, they ignored it, and even released another, version 2.0, of their WSDL with the same mistake in it. I don’t know what they’re doing over there… I can hardly believe that they are allowing this mistake to continue to live in production for weeks (now becoming months).

Read the rest of this entry »

Load javascript with random query param

For now, I am just getting this logged somewhere I can find it later:

Code:
<script>
  var el = document.createElement( “script” );
  el.setAttribute( “type”, “text/javascript” );
  el.setAttribute( “src”, “time.php?rand=”+bigRandomString);
  document.getElementsByTagName( “head” )[ 0 ].appendChild( el );

  function receiveTime(minLeft)
  {
     // Do whatever
  }
</script>

time.php:

<?php

$minleft = “whatever”;
print “receiveTime($minleft);”
exit;

?>

Read the rest of this entry »

Turn a Text Form Element into a drop down / text box

Imagine you have a text box, like this:

Name: [ ]
Email: [ ]

You want them to be text boxes that the user can type in, but you also have some default choices to give. For example, I may have an address book in a database and may want to provide an autocomplete function on these fields.

So, I wrote a generic javascript package to be able to do this. I call it, “dropbox”. It allows you to turn any text input element into a text/dropbox element. You just define an array of choices to be displayed. It will show the whole list, onfocus, if the field is empty, but will reduce it’s selection set as the user types. In other words, it acts as an autocomplete selection drop down.

Read the rest of this entry »

Storing weak passwords stronger

PostPosted: Wed Aug 24, 2005 12:18 am Post subject: Reply with quote
We store our passwords in an md5 style password hash that the PHP crypt function provides. It takes a 13 character salt.

My friend and co-worker brought up a good discussion with me. The discussion was what if the database was to be compromised. Could the passwords be cracked? The answer: yes, a dictionary/brute force cracker, like John the Ripper, could be used to crack as many passwords as possible. In a database with over 1 million passwords, a percentage of them are crackable, probably a large percent.

So, the idea of using a different algorithm to store passwords came up. What if we used:

Read the rest of this entry »

Using Curl 101

To use Curl in PHP, you must have the Curl extension compiled in –with-curl, and you’ll want –with-openssl, if you need to be able to hit https pages.

Once you get PHP working with Curl (I could explain how to do that, but for this article, I am focusing on how to use it).

The code below is for PHP5, but I’m sure you could modify it to work with PHP4, just have to change the syntax a bit.

Read the rest of this entry »

PHP Sessions using MySQL

MySQL sessions are “gotta have it” thing if your site ever grows beyond single server. If you have multiple servers behind a load balancer, you could keep session data on a shared SAN, but MySQL makes for a better session store.

Create a file called MySession.php and put this code in it, replace the definitions to match your database. Also, it requires the PEAR DB.php module, make sure you have pear DB installed: pear install DB.

Read the rest of this entry »