Symfony2 : send a HTTP Request

后端 未结 6 713
旧巷少年郎
旧巷少年郎 2021-01-31 21:57

I am trying to make a HTTP Request from one of my controller to contact another URL, the goal being to contact another URL, and to simply print the HTML answer in my page. I tri

6条回答
  •  [愿得一人]
    2021-01-31 22:44

    Why not use curl? From PHP manual

    $ch = curl_init("http://www.example.com/");
    
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    
    result = curl_exec($ch);
    curl_close($ch);
    

提交回复
热议问题