dqz84361326 2014-09-12 22:32 采纳率: 0%
浏览 42
已采纳

从PHP中的Netsuite File Cabinet获取图像URL

Is it possible to grab the url Netsuite uses for an item image using the PHP Toolkit? Using this function:

function getProduct($id) {

  $service = new NetSuiteService();
  $service->setSearchPreferences(false, 1000);

  $itemInfo = new SearchMultiSelectField();
  $itemInfo->operator = "anyOf";
  $itemInfo->searchValue = array('internalId' => $id);

  $search = new ItemSearchBasic();
  $search->internalId = $itemInfo;

  $request = new SearchRequest();
  $request->searchRecord = $search;

  $searchResponse = $service->search($request);
  $products = $searchResponse->searchResult->recordList->record;

  return $products;

}

I can get the item information. In the information, netsuite gives me this little snippet (the whole thing is truncated for cleanliness):

...
[storeDisplayImage] => RecordRef Object
    (
        [internalId] => 19876
        [externalId] => 
        [type] => 
        [name] => 4010024.jpg
    )
...

This just tells me the name of the file in the Netsuite file cabinet. How do I download that image automatically using the PHP Toolkit?

  • 写回答

2条回答 默认 最新

  • douyun8674 2014-10-18 04:25
    关注

    Try this:

    $request2 = new GetRequest();
    $request2->baseRef = new RecordRef();
    $request2->baseRef->internalId = $product->storeDisplayImage->internalId;
    $request2->baseRef->type = "file";
    $getResponse2 = $this->service->get($request2);
    if (!$getResponse2->readResponse->status->isSuccess) {
            echo "GET ERROR";
    } else {
        $file = $getResponse2->readResponse->record;
        echo "GET SUCCESS, File name is " . $file->name;
        echo "<img src='".$file->url."'>";
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改