Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在保存字符串时陷入困境_Php_Json_String_Curl - Fatal编程技术网

Php 在保存字符串时陷入困境

Php 在保存字符串时陷入困境,php,json,string,curl,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": "",

保存字符串时,我会得到一个已编码的字符串 当我保存时:

'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
    }'

CURLOPT_ENCODING
设置另一个curl选项,并将其设置为“”,以确保它不会返回任何垃圾

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

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
}'

有关更多信息,请参见此

对每条字符串使用
html\u entity\u decode()
,它似乎不起作用