0
Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "HEAD", "https://work's domain (I am not sure if im allowed to put it here or not. I apologize for any inconvenience)/Images/FSR/" & f1 & "/" & f2 & "/" & fsnm & ".htm", False
xmlhttp.send

Select Case Cint(xmlhttp.status)
   Case 200, 202, 302
     Set xmlhttp = Nothing

I have an ASP file which I am trying to convert into a PHP. The entire file has been converted except for one part; the code above. I have searched everywhere and tried everything, and I have yet to find a way or a solution to this problem. Any help would be greatly appreciated.

edit: This is what I have so far.

// $xmlhttp->open("HEAD", "https://.../Images/FSR/".$f1."/".$f2."/".$fsnm.".htm", false);
// $xmlhttp->send;

$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => 'https://.../Images/FSR/' . $f1 . '/' . $f2 . '/' . $fsnm . '.htm',
    CURLOPT_POST => 1
));
$response = curl_exec($ch);
curl_close($ch);

// OR $xmlhttp->status? OR neither??
switch(intval($xmlhttp->http_response_code()))
{
   case 200:
   case 202:
   case 302:
           $xmlhttp = NULL;
           redirects to another page  
   break;
   default:
      $xmlhttp = NULL;
      echo "Image not created, it may not be available yet.";
}
azunyan
  • 33
  • 7
  • 1
    That just looks like an ordinary HTTP request. Look into [cURL](https://www.php.net/manual/en/book.curl.php) or any of the many HTTP-libraries that exists for PHP (like [Guzzle](https://github.com/guzzle/guzzle), [HTTPful](https://github.com/nategood/httpful) or similar). – Magnus Eriksson Jul 01 '19 at 12:53
  • Show what you tried. Show/describe the result. How does it differ from the desired result? – Patrick Q Jul 01 '19 at 12:54
  • https://stackoverflow.com/questions/11797680/getting-http-code-in-php-using-curl – Patrick Q Jul 01 '19 at 13:08

0 Answers0