How to make a request to a web page with PHP?

后端 未结 5 1239
感动是毒
感动是毒 2021-01-21 06:57

What i\'m trying to achieve is this:

1st- I want to query a page like google but without filling it\'s search filed manually 2nd- I want to get the result and save it to

5条回答
  •  情话喂你
    2021-01-21 07:20

    setOptions(array('lastmodified' => filemtime('local.rss')));
    $r->addQueryData(array('category' => 3));
    try {
        $r->send();
        if ($r->getResponseCode() == 200) {
            file_put_contents('local.rss', $r->getResponseBody());
        }
    } catch (HttpException $ex) {
        echo $ex;
    }
    ?>
    

    From the php manual...

提交回复
热议问题