0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ヤフオクAPI simplexmlの & のエスケープについて質問

Last updated at Posted at 2015-02-05

お世話になります。
ヤフオクAPIを利用しマイオークションの情報を取得しているのですが、商品情報に「&」があるためsimplexmlがエラーとなり表示が出来ない状態です。
preg_replaceを用いても置換がされません。
解決情報を教えてください。

Warning: simplexml_load_string(): Entity: line 3021: parser error : EntityRef: expecting ';' in

CODE

$accessToken = $_SESSION['access_token'];
$ch = curl_init();
$options = array(
CURLOPT_URL => "https://auctions.yahooapis.jp/AuctionWebService/V2/myCloseList?list=sold"
,CURLOPT_HTTPHEADER =>array("Authorization: Bearer $accessToken ")
);
curl_setopt_array($ch, $options);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($ch);

$response = preg_replace('/&(?=[a-z_0-9]+=)/m','&',$response ); //置換しない・・・

var_dump($response);

echo "


";
$xml = simplexml_load_string($response,'SimpleXMLElement');
curl_close($ch);
0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?