On 27 Oct 2009, at 15:11, James Lin wrote:

Hi all,

I am still having the mysterious error of "Internal Error 500" message returned from stringWithContentsOfURL.

I am using stringWithContentsOfURL to call a php script that add an entry to MySQL database.

My ISP claims that they have removed all security restrictions on my php script. Aside from continue to press my ISP's tech support, I have to look for alternatives...

Is there an alternative to stringWithContentsOfURL in Cocoa that I can try?

According to the Mac OS X docs, stringWithContentsOfURL: is deprecated.

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/DeprecationAppendix/AppendixADeprecatedAPI.html#jumpTo_2

Not that the alternatives that the docs suggest will help you much because the server appears to be returning HTTP 500 error which means something is going wrong in your PHP script.

I would speculate that Cocoa sends a GET request to the server, so the first thing I would try is to send a get request using telnet e.g. if your URL is http://example.com/path/to/script.php? aparm=a&anotherparm=y, you need to open a terminal and run telnet:

telnet example.com 80
GET /path/to/script.php?aparm=a&anotherparm=y HTTP/1.1
Host: example.com

(press the CR key twice after the Host: line).

You'll either get a 200 response and your expected content or a 500 response. If you get 200, then the Cocoa method must be adding some other stuff to the HTTP request and you'll need to try tcpdump to sniff the TCP traffic. The following seems to give useful info:

sudo tcpdump -i en1 -A port 80

(en1 is the bsd device for my wireless lan, use ifconfig to get the device for your network, it's probably en0 or en1)

If you get a 500 response, either your URL has invalid characters in it (which your browser is dealing with, hence why it works from a browser) or your PHP script can't deal with a bare URL with no cookies.



Thank you in advance...

James
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/adc%40jeremyp.net

This email sent to a...@jeremyp.net


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to