cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Problems when posting HTML data

From: Spyros Spyropoulos <spyross_at_gmail.com>
Date: Thu, 15 Nov 2007 01:07:49 +0200

Hello!

Could anyone suggest why this error occurs

I am using a script that sends some post data, among wich is some HTML as well.
This is where the problem seems to be. When I add HTML to the url
parameters, something goes wrong and the server that receives the
message returns an error

This script works fine on my local development server, but when I
upload it to my hosting provider, it does not! When I add HTML to
$faxData (see below), even if its just one tag (no special characters
like spaces or new lines) the
server that I am trying to connect to returns the error that is on the
bottom of this message

Here is the script:
$faxData = 'THIS IS A TEST'; // Plain text like this works. When I add
html, even the simplest like a plain head tag, the error occurs
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_URL, 'http://ws.interfax.net/SendCharFax.aspx');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"Username=username&Password=somepassword&FaxNumber=000011112222&FileType=HTML&Data=$faxData");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close ($ch);
print $result;

$result should be the transaction ID number, but I receive the
following instead:

Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current
custom error settings for this application prevent the details of the
application error from being viewed remotely (for security reasons).
It could, however, be viewed by browsers running on the local server
machine.

Details: To enable the details of this specific error message to be
viewable on remote machines, please create a <customErrors> tag within
a "web.config" configuration file located in the root directory of the
current web application. This <customErrors> tag should then have its
"mode" attribute set to "Off".

<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a
custom error page by modifying the "defaultRedirect" attribute of the
application's <customErrors> configuration tag to point to a custom
error page URL.

<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>

Thanks for any help!!!
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-11-15