Jump to content

leesiulung

Members
  • Posts

    83
  • Joined

  • Last visited

    Never

Posts posted by leesiulung

  1. Sorry, that url just happens to be there as I was typing it in. I will try to be clearer next time.

     

    The correct url is 'http://services.xmethods.net/soap'. I'm trying to send a soap envelope, but with the content-type set at text/xml the proxy.php page does not receive the POSTED data sent by the XMLHttpRequestObject.

     

    I will edit the code in original post to reflect this.

     

    edit: actually I can't edit the original post as there is no such option on the page.

  2. Basically, I'm writing my own proxy for AJAX using the XMLHttpRequest object. My problem is with an asynchronous call as follows:

     

       if(XMLHttpRequestObject.overrideMimeType) XMLHttpRequestObject.overrideMimeType('text/xml');
    
       url = 'proxy.php?proxy_url=' + escape('http://www.google.com');  
       XMLHttpRequestObject.open('POST', url, true);
       XMLHttpRequestObject.setRequestHeader('Content-Type', 'text/xml');
       XMLHttpRequestObject.setRequestHeader('SOAPAction', '""');
       XMLHttpRequestObject.onreadystatechange = getResults;
    
       XMLHttpRequestObject.send(....)
    

     

    The problem I have is that the proxy.php page is not able to retrieve the information being sent in the $_POST array. Where should this data be? Since the XMLHttpRequestObject does not name the data like a regular POST from a form with fields....

     

    How can I retrieve this data?

     

    Any help would be much appreciated as I spent many days on this problem.

     

    Note, this problem stem from an earlier post that asked a different question. Basically I had to create my own proxy script since the original ones I used did not supply the correct information to the server in the header etc... I can't seem to edit my posts. Is there an edit button I missed?

     

    Other thread here

     

    edit: found the edit button.

  3. Heaven forbid the platform be highly configurable and give you a plethora of functions so that you don't have to keep including your custom functions to make up for those that are lacking. I have on a couple of occasions written a function to do some task only to find out that PHP already had one to do that for me. Now, perhaps I should have looked a little harder and perhaps the naming is not as intuitive, but is that a bad thing to have so many functions?

     

    It is in fact a bad thing to have so many functions. Aside from the obvious too many functions lead to confusion, there is also another side effect. People looking at other people's code will spend a lot of time deciphering obscurely named functions. Too many functions also lead to the issue you had were you can't find what you need easily.  In addition, some functions are likely to open one up to vulnerabilities. I could continue with this...

     

    In terms of configurations, if there are too many it leads to a steep learning curve and that will likely have many of its users using incorrect settings.

     

    I think this is attributed to the fact that PHP has no strict data type, so one can't easily have different signatures. The functions aren't thought out and grouped properly. Overall to me it seems PHP is not thought out, OO breaks the fundamental rules of OO, functions are not type checked leading to too many, magic quotes clashing with XML etc...

     

    The only thing PHP seems to have is it is FREE and potentially a slight speed advantage that is narrowing every day. Free is a very powerfull thing and is probably why it is used so much. What surprises me is some large companies chooses to use PHP over competing languages.

  4. I'm trying to use PHP to proxy a SOAP envelope. I tried various things like:

     

    1) http://www.practicalwebmaster.com/entries/using-php-to-proxy-remote-url-ajax-requests.html

     

    2) http://www.troywolf.com/articles/

     

    They sort of work, but neither is able to send a SOAP envelope.

     

    Here is a snippet of the code I would use:

     

    
        xmlDoc = // get an XMLHttpRequest object appropriate for browser type
        if(xmlDoc.overrideMimeType) xmlDoc.overrideMimeType('text/xml');
    
        url = 'http://services.xmethods.net/soap'; // url to proxy
        url = 'proxy.php?proxy_url=' + escape(url);  // assume proxy is in current directory
        xmlDoc.open('POST', url, true);
        xmlDoc.setRequestHeader('Content-Type', 'text/xml');
        xmlDoc.setRequestHeader('SOAPAction', '""');
        xmlDoc.onreadystatechange = getResults;
        req.send(
        // Soap Envelope
       );
    

     

    Anyone have any ideas?

  5. Well, somebody I know ran into this problem where in php4 they used <? ?> (or some variation thereof) for php code, but when upgraded php5 would not work with it. They ended up using <?php ?> instead and changed all of their code.

     

    This probably is due to setup and configuration of PHP, but that brings up another point. Security with PHP is more difficult than let say ColdFusion since a lot of it is automatically handled by CF or it at least have functions that will do a lot of the work for you. Seems like PHP have many obscure settings and finicky things and the myriad of functions to boot.

     

    I still haven't figured out what those magic quotes are yet.... I have been told it stops code injection attacks.

  6. I'm sort of new to the PHP world and frankly stayed away from it due to numerous complaints about PHP compatibility between major versions. In the past I have used Servlets/JSP and ColdFusion as the language of choice as they are always backwards compatible.  :o

     

    However, lately I have reconsidered PHP due to its enourmous popularity and availability at leading hosting companies. How do everyone handle the finicky PHP compatibility when upgrading between major versions?

     

    I am also somewhat dissappointed in the language API with a plethora of functions that seems to only confuse due to the sheer number of poorly named functions.

     

    This might not be the right forum to post in, but I wanted to hear what the PHP programmers think of this issue....  :-\

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.