• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CFHTTP POST bug? or PHP bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFHTTP POST bug? or PHP bug?


  • Subject: Re: CFHTTP POST bug? or PHP bug?
  • From: "Mark A. Stratman" <email@hidden>
  • Date: Sat, 29 May 2004 15:27:25 -0500

In case anyone else comes across this problem, here's a follow-up:

I filed a bug report with Apple. They haven't responded to it yet, but
they did change the title of the report to
"CFHTTPMessages don't include Content-Type headers, but PHP needs them "

So adding the Content-Type header manually seems work for POST requests
to PHP.
Example:
CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Content-Type"),
CFSTR("application/x-www-form-urlencoded"));
Where "request" is a CFHTTPMessageRef.

- Mark

On May 28, 2004, at 7:05 PM, Mark A. Stratman wrote:

> It's not a problem with the PHP script. You can try a post with
> curl, LWP, etc and it works just fine.
>
> There's obviously something about the format of the POST request
> generated by Apple's example code that PHP itself does not like. What
> I don't know, however, is whether the POST request is totally rfc
> compliant and PHP has a bug, or if the request is invalid in some way
> and PHP is acting appropriately (and CGI::param() just happens to
> parse it anyway, per chance).
>
> The URLs i posted with example perl/php scripts are just bare-bones
> examples to illustrate the problem.
> The actual script in question has been successfully in use for quite
> some time now - I'm rewriting a Windows application for OS X.
>
> Thanks
> - Mark
>
> On May 28, 2004, at 10:53 AM, Izidor Jerebic wrote:
>
>>
>> On 27 May 2004, at 11:05, Mark A. Stratman wrote:
>>
>>> Sending POST requests with CFHTTP functions seems to have a serious
>>> problem with PHP - the parameters sent are not recognized. Perl's
>>> CGI.pm, on the other hand, can parse them just fine with param();
>>>
>>>
>>
>> The PHP docs say this:
>>
>>> // Available since PHP 4.1.0
>>>
>>> echo $_POST['username'];
>>> echo $_REQUEST['username'];
>>>
>>> import_request_variables('p', 'p_');
>>> echo $p_username;
>>>
>>> // Available since PHP 3. As of PHP 5.0.0, these long predefined
>>> // variables can be disabled with the register_long_arrays directive.
>>>
>>> echo $HTTP_POST_VARS['username'];
>>>
>>> // Available if the PHP directive register_globals = on. As of
>>> // PHP 4.2.0 the default value of register_globals = off.
>>> // Using/relying on this method is not preferred.
>>>
>>> echo $username;
>>>
>>
>> What PHP version are you running? Did you try other alternatives for
>> obtaining parameters?
>>
>> izidor
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >CFHTTP POST bug? or PHP bug? (From: "Mark A. Stratman" <email@hidden>)
 >Re: CFHTTP POST bug? or PHP bug? (From: Izidor Jerebic <email@hidden>)
 >Re: CFHTTP POST bug? or PHP bug? (From: "Mark A. Stratman" <email@hidden>)

  • Prev by Date: Re: Cocoa Rules - ObjC "evalgelism"
  • Next by Date: Re: Cocoa Rules - ObjC "evalgelism"
  • Previous by thread: Re: CFHTTP POST bug? or PHP bug?
  • Next by thread: Notification from ABPeoplePickerView
  • Index(es):
    • Date
    • Thread