SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast zyON's Avatar
    Join Date
    Jun 2003
    Location
    Portugal
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Sending a XML string with cURL

    I'm trying to use cURL to send a xml string to a site like this:

    $ch = curl_init("http://www.somesite.com/scripts/Bookings.dll/ULogin?xml_content=<xml><db id='4'/><golfcourses><agent%20id='VDL'></agent><region%20id='1'></region></golfcourses></xml>");
    $output=curl_exec($ch);


    But it seems like it has some problem sending the '<' and '>' characters and I get a "Bad Request".

    How can I send a string with '<' and '>' characters with cURL?

  2. #2
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some servers may have a secure setting set that doesn't allow "code" to be posted in url attachements, such as "<", "/" etc. ? I may be wrong though.

    Maybe you want to tell us in which context you want to use this. It's just that a hidden form field might work as well...

  3. #3
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Umm... Not used Curl yet [extension doesn't work on my PHP install for some reason] though < and > are actually entities...

    Try using &lt; [<] and also &gt; [>] instead ? Some browsers have bother with entities in the url from what I've read elsewhere.

  4. #4
    SitePoint Enthusiast zyON's Avatar
    Join Date
    Jun 2003
    Location
    Portugal
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Ok, I figured out that the simple use of urlencode() solves the problem.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •