卡在保存一个字符串

时间:2017-06-05 07:42:01

标签: php json string curl

我在保存字符串时得到一个编码字符串 当我保存时:

'FFFA

我得到:

'FFFA

如何使用ff curl请求保存它们:

curl "https://api.adbutler.com/v1/banners/custom-html" \
-H "Authorization: Basic {API_KEY}" \
-H "Content-Type: application/json" \
-X POST \
-d '{  
      "custom_html": "",
      "expand_horizontal_direction": "left",
      "expand_vertical_direction": "down",
      "height": 250,
      "html_content_below": "Hello 'world",
      "location": "http://www.google.ca",
      "name": "Demo Custom HTML' Banner",
      "tracking_pixel": "url",
      "width": 300
    }'

2 个答案:

答案 0 :(得分:0)

CURLOPT_ENCODING设置另一个卷曲选项并将其设置为""确保它不会返回任何垃圾

     $location = 'https://api.adbutler.com/v1/banners/custom-html';
$ch = curl_init($location);
       curl_setopt($ch, CURLOPT_ENCODING ,"");

答案 1 :(得分:0)

你可以试试这个

curl "https://api.adbutler.com/v1/banners/custom-html" \
-H "Authorization: Basic {API_KEY}" \
-H "Content-Type: application/json" \
-X POST \
-d '{  
  "custom_html": "",
  "expand_horizontal_direction": "left",
  "expand_vertical_direction": "down",
  "height": 250,
  "html_content_below": "Hello '\''world",
  "location": "http://www.google.ca",
  "name": "Demo Custom HTML'\'' Banner",
  "tracking_pixel": "url",
  "width": 300
}'

请参阅此link了解详情