zoukankan      html  css  js  c++  java
  • PHP curl post的contenttype导致获取不到数据的问题

    <?php
    $url="http://www.otcmarkets.com/edgar/ajax/GetFilings.json";
    $keysArr = array(
        "symbol"=>"FSCND",
        "body"=>"[object HTMLDivElement]",
        "progressBarBody"=>"[object HTMLQuoteElement]",
        "progressBarOn"=>"true",
        "progressBarCount"=>"0",
        "progressBarIntervalId"=>"2255",
        "pageSize"=>"10"
    );
    $keysArr = 'bady=[object HTMLDivElement]&pageSize=10&progressBarBody=[object HTMLBlockElement]&progressBarCount=0&progressBarIntervalId=453&progressBarOn=true&symbol=FSCND';
    //↑这样的content-type是application/x-www-form-urlencoded

    //↓这个却是multipart/form-data; boundary=---...
    /*$keysArr = "symbol=".urlencode("FSCND"). "&body=".urlencode("[object HTMLDivElement]"). "&progressBarBody=".urlencode("[object HTMLQuoteElement]"). "&progressBarOn=".urlencode("true"). "&progressBarCount=".urlencode("0"). "&progressBarIntervalId=".urlencode("2255"). "&pageSize=".urlencode("10"); */ //$keysArr = array("gid"=>"518b657e8ead0e0f3600002a","token"=>"MGVmMStnZTYzd2R2OUMrdHJ4cHBteDNCV0FLdFFTSjF3OW9pYnZvdllFWVQ6Nzc2M0RXdGthNDB3NnJiNTMwN21EblRuNU9VUUI0c29UalBEdWxiZi96cStVb2xPZ3l0bzRRWWN0YUYwaWJMRGlZTU5qQU10YTlKUTlseUsvdw==","key"=>"204009a2fe7165d4f48239f91bc0d9d8");; // echo md5("lijuan698191"); // $keysArr = array('login_type'=>0,'key'=>"204009a2fe7165d4f48239f91bc0d9d8",'login_time'=>"1387128272",'mobile_info'=> "moxian:iphone&105&3d7b8b0c74b314ab1815b76f989d79e8&6.1&iPhone Simulator",'user_name'=>"guo_yu_bin@yeah.net",'user_pwd'=> "828a966d1af427fa58bf08d9c131aac5"); // $keysArr = array("gid"=>"5188760b7f8b9a643b000002"); $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $keysArr); //参数 curl_setopt($ch, CURLOPT_URL, $url); //curl_setopt($ch, CURLOPT_HEADER ,TRUE); $ret = curl_exec($ch); curl_close($ch); echo $ret;
  • 相关阅读:
    401. Binary Watch
    46. Permutations
    61. Rotate List
    142. Linked List Cycle II
    86. Partition List
    234. Palindrome Linked List
    19. Remove Nth Node From End of List
    141. Linked List Cycle
    524. Longest Word in Dictionary through Deleting
    android ListView详解
  • 原文地址:https://www.cnblogs.com/arliang/p/PHP_curl_content_type.html
Copyright © 2011-2022 走看看