3

私は、「介入する動き」や「強制する動き」など、既存の訴訟事件のドックを検索するスクリプトを作成しました。正規表現がtrueを返す場合、公開用にオンラインでスキャンされたドキュメントの画像があるかどうかを確認します。その画像はTIFFファイルですが、通常のTIFFファイルではありません。これは、私が自分のサーバーにコピーしようとしているものの例へのリンクです。

http://www.oscn.net/applications/oscn/getimage.tif?submitted=true&casemasterid=2565129&db=OKLAHOMA&barcode=1012443256

http://www.oscn.net/applications/oscn/getimage.tifだけを見ようとすると発生するエラーは次のとおりです。

これはTIFFファイルですが、動的です。fopen()、CURLなどを使用しましたが成功しませんでした。サーバーがこのタイプのものを許可し、それが機能することを確認するために、ランダムなサイトからのJPG画像でこれらのタイプの関数を使用しました。

サーバーにPDFlibがインストールされていません(PEARを確認しましたが、PEARも利用できませんが、100%確実ではありません)。ホストはcPanelを使用しています。サーバーはApacheを実行しています。この問題の解決策を他にどこで探すべきかわかりません。

PDFlibを使用するソリューションをいくつか見てきましたが、それぞれが動的に作成されたものではなく、通常のTIFFイメージを取得しました。私の考えでは、画像データをストリーミングできるかどうかは問題ではありませんが、fopen()を使用して、そのデータを自分の.tifファイルに書き込んだりバッファリングしたりすることはできませんか?

入力と幸せな感謝祭をありがとう!

更新:問題はCURLにあるのではなく、CURLに渡すためにスクレイプしたURLにありました。$ urlを画面に印刷すると、正しく見えましたが、そうではありませんでした。どこかで&が&に変わり、無効なURLをフェッチしていたため(少なくともTIFファイルがあるリモートサーバーでは無効)、CURLが破棄されました。

後でこれを見つけた方のために、ここに完全に機能するスクリプトがあります。

//*******************************************************************************
$url = 'http://www.oscn.net/applications/oscn/getimage.tif"
$url .= '?submitted=true&casemasterid=2565129&db=OKLAHOMA&barcode=1016063497';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); // set the url
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // get the transfer as a string, rather than output it directly

print "Attempting to fetch file...\n";
$img = curl_exec($ch); // get the image

//I used the time() so that in testing I would know when a new file was created rather than always overwriting the old file. This will be changed for final version
if($img){
  $fh = fopen('oscn_docs/' . time(). '.tif', 'w'); // this will simply overwrite the file. If that's not what you want to do, you'll have to change the 'w' argument!
  if($fh){
    $byteswritten = fwrite($fh, $img);
    fclose($fh);
  }else{
    print "Unable to open file.\n";
  }
}else{
  print "Unable to fetch file.\n";
}

print "Done.\n";
exit(0);
//*******************************************************************************

ジャロッド

4

1 に答える 1

0

後でこれを見つけた人のために、完全に機能するスクリプトを次に示します。

//*******************************************************************************
$url = 'http://www.oscn.net/applications/oscn/getimage.tif"
$url .= '?submitted=true&casemasterid=2565129&db=OKLAHOMA&barcode=1016063497';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); // set the url
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // get the transfer as a string, rather than output it directly

print "Attempting to fetch file...\n";
$img = curl_exec($ch); // get the image

//I used the time() so that in testing I would know when a new file was created rather than always overwriting the old file. This will be changed for final version
if($img){
  $fh = fopen('oscn_docs/' . time(). '.tif', 'w'); // this will simply overwrite the file. If that's not what you want to do, you'll have to change the 'w' argument!
  if($fh){
    $byteswritten = fwrite($fh, $img);
    fclose($fh);
  }else{
    print "Unable to open file.\n";
  }
}else{
  print "Unable to fetch file.\n";
}

print "Done.\n";
exit(0);
//*******************************************************************************
于 2019-08-14T02:41:30.183 に答える