title: how to download users twitter images from API with php
body: <p>i am trying to download twitter users images that sign up in my website such that i can save them in my file to insert into my database later on for use in my website.</p>
  
  <p>this is my TWITTER API:</p>
  
  <pre><code> $user_pic = $user_info-&gt;profile_image_url_https;
  </code></pre>
  
  <p>i tried this and it works but i want it to download the image to my base file which is profilePictures/:</p>
  
  <pre><code>$twitterimage = file_get_contents($user_pic);
      $fp = fopen('path_to_filename.png', 'w');
      fwrite($fp, $twitterimage); 
      fclose($fp); 
  </code></pre>
  
  <p>now it is being downloading but  how can i download the twitter images and save them in my base file "profilePictures/"?</p>