Post Parameters Strangely Parsed Inside Phantomjs
I am working with PHP/CURL and would like to send POST data to my phantomjs script, by setting the postfields array below: In my php controller I have: $data=array('first' => 'J
Solution 1:
It looks like the form is being encoded as multipart/form-data
rather than application/x-www-urlencoded
. Apparently PHP does this when the value of CURLOPT_POSTFIELDS
is an array. You could check this by adding console.log(request.headers)
to your debug code.
Unfortunately, it looks like PhantomJS doesn't support multipart/form-data
. If you're not willing to find another web server, the easiest solution is probably to manually encode the data using JSON. I've fixed the mistake in my previous answer and added some example code.
Post a Comment for "Post Parameters Strangely Parsed Inside Phantomjs"