dousong2023 2012-10-02 16:49
浏览 92

cURL似乎无效

I am trying to find out what my completed URL looks like when sending my xml file as a PARAM using cURL. However, I'm not seeing what cURL is creating for me to send to my java servlet on my apache tomcat server.

Any HELP/DIRECTION would be greatly appreciated. Thank you.

Here are my specs:

My $data:

    object(SimpleXMLElement)#1 (5) {
  ["version"]=>
  string(3) "2.0"
  ["orderNo"]=>
  string(37) "sfly.000020513524-7001536_28935-tb.33"
  ["orderDate"]=>
  string(23) "2012-09-21 09:52:53 PDT"
  ["processing"]=>
  object(SimpleXMLElement)#2 (1) {
    ["statusCallback"]=>
    string(79) "http://orderfulfillment.shutterfly.com/ogateway-test/status/sfly/xpressdocs/
        "
  }
  ["suborders"]=>
  object(SimpleXMLElement)#3 (1) {
    ["suborder"]=>
    object(SimpleXMLElement)#4 (7) {
      ["suborderNo"]=>
      string(5) "51917"
      ["deliveryEstimate"]=>
      object(SimpleXMLElement)#5 (2) {
        ["earliest"]=>
        string(23) "2012-10-01 00:00:00 PDT"
        ["latest"]=>
        string(23) "2012-10-05 00:00:00 PDT"
      }
      ["greeting"]=>
      object(SimpleXMLElement)#6 (2) {
        ["line1"]=>
        string(45) "Ordered for you by Andrew Mullen on 09/21/12."
        ["line2"]=>
        string(61) "Save 20% on Holiday Cards November 20 - 30 at Shutterfly
                "
      }
      ["shipAddr"]=>
      object(SimpleXMLElement)#7 (8) {
        ["name"]=>
        string(12) "burkina faso"
        ["address1"]=>
        string(17) "1234 burkina road"
        ["address2"]=>
        object(SimpleXMLElement)#9 (0) {
        }
        ["city"]=>
        string(4) "yako"
        ["region"]=>
        string(3) "R21"
        ["postCode"]=>
        object(SimpleXMLElement)#10 (0) {
        }
        ["countryCode"]=>
        string(2) "BF"
        ["countryName"]=>
        string(12) "Burkina Faso"
      }
      ["shipMethod"]=>
      string(7) "INTLSTD"
      ["additionalFulfillers"]=>
      string(5) "false"
      ["items"]=>
      object(SimpleXMLElement)#8 (1) {
        ["item"]=>
        object(SimpleXMLElement)#11 (6) {
          ["itemNo"]=>
          string(2) "36"
          ["sku"]=>
          string(13) "6X8FLATCARD06"
          ["description"]=>
          string(39) "6x8 Stationery Card - Stacy Claire Boyd"
          ["quantity"]=>
          string(1) "1"
          ["product"]=>
          object(SimpleXMLElement)#12 (1) {
            ["stationery"]=>
            object(SimpleXMLElement)#14 (6) {
              ["formFactor"]=>
              string(3) "6x8"
              ["paperFinish"]=>
              string(5) "MATTE"
              ["orientation"]=>
              string(9) "LANDSCAPE"
              ["image"]=>
              object(SimpleXMLElement)#15 (1) {
                ["location"]=>
                string(130) "http://orderfulfillment.shutterfly.com/fulfillment-test/image/1200/000020513524-7001536_28935--164044--315625--canvas.jpg
                                "
              }
              ["boc"]=>
              object(SimpleXMLElement)#16 (1) {
                ["location"]=>
                string(130) "http://orderfulfillment.shutterfly.com/fulfillment-test/image/1200/000020513524-7001536_28935--164044--315626--canvas.jpg
                                "
              }
              ["copyright"]=>
              object(SimpleXMLElement)#17 (1) {
                ["text"]=>
                string(13) "6X8FLATCARD06"
              }
            }
          }
          ["envelopes"]=>
          object(SimpleXMLElement)#13 (1) {
            ["envelope"]=>
            object(SimpleXMLElement)#18 (2) {
              ["toAddress"]=>
              object(SimpleXMLElement)#19 (10) {
                ["font"]=>
                object(SimpleXMLElement)#21 (2) {
                  ["fontName"]=>
                  string(5) "Arial"
                  ["fontSize"]=>
                  string(2) "12"
                }
                ["name"]=>
                string(10) "FPO Tester"
                ["companyTitle"]=>
                object(SimpleXMLElement)#22 (0) {
                }
                ["address1"]=>
                string(16) "PSC 812 Box 2640"
                ["address2"]=>
                object(SimpleXMLElement)#23 (0) {
                }
                ["city"]=>
                string(3) "FPO"
                ["region"]=>
                string(2) "AE"
                ["postCode"]=>
                string(5) "09627"
                ["countryCode"]=>
                string(3) "USA"
                ["countryName"]=>
                string(24) "United States of America"
              }
              ["fromAddress"]=>
              object(SimpleXMLElement)#20 (10) {
                ["font"]=>
                object(SimpleXMLElement)#24 (2) {
                  ["fontName"]=>
                  string(5) "Arial"
                  ["fontSize"]=>
                  string(2) "12"
                }
                ["name"]=>
                string(13) "Andrew Mullen"
                ["companyTitle"]=>
                object(SimpleXMLElement)#25 (0) {
                }
                ["address1"]=>
                string(22) "2333 W. El Moro Circle"
                ["address2"]=>
                object(SimpleXMLElement)#26 (0) {
                }
                ["city"]=>
                string(4) "Mesa"
                ["region"]=>
                string(2) "AZ"
                ["postCode"]=>
                string(5) "85202"
                ["countryCode"]=>
                string(3) "USA"
                ["countryName"]=>
                string(24) "United States of America"
              }
            }
          }
        }
      }
    }
  }
}

My $url = 'http://melinda.xpressdocs.com/PostHandler';

Here is my code:

    function postToUrl($url, $data) {

    $post = curl_init();

    curl_setopt($post, CURLOPT_URL, $url);
    curl_setopt($post, CURLOPT_POST, 1);
    curl_setopt($post, CURLOPT_POSTFIELDS, $data);
    curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);

    $value = curl_getinfo($post);
    var_dump($value);
    exit;

    $result = curl_exec($post);

    curl_close($post);
}

Results of var_dump:

    array(20) {
  ["url"]=>
  string(42) "http://melinda.xpressdocs.com/PostHandler/"
  ["content_type"]=>
  NULL
  ["http_code"]=>
  int(0)
  ["header_size"]=>
  int(0)
  ["request_size"]=>
  int(0)
  ["filetime"]=>
  int(0)
  ["ssl_verify_result"]=>
  int(0)
  ["redirect_count"]=>
  int(0)
  ["total_time"]=>
  float(0)
  ["namelookup_time"]=>
  float(0)
  ["connect_time"]=>
  float(0)
  ["pretransfer_time"]=>
  float(0)
  ["size_upload"]=>
  float(0)
  ["size_download"]=>
  float(0)
  ["speed_download"]=>
  float(0)
  ["speed_upload"]=>
  float(0)
  ["download_content_length"]=>
  float(-1)
  ["upload_content_length"]=>
  float(-1)
  ["starttransfer_time"]=>
  float(0)
  ["redirect_time"]=>
  float(0)
}
  • 写回答

1条回答 默认 最新

  • dsour68888 2012-10-02 16:54
    关注

    Set CURLOPT_VERBOSE to true to see what cURL is doing

    评论

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler