爱程序网

手把手教你做关键词匹配项目(搜索引擎)---

来源: 阅读:

第九天

回顾:

8. 手把手教你做关键词匹配项目(搜索引擎)---- 第八天

7. 手把手教你做关键词匹配项目(搜索引擎)---- 第七天

6. 手把手教你做关键词匹配项目(搜索引擎)---- 第六天

5. 手把手教你做关键词匹配项目(搜索引擎)---- 第五天

4. 手把手教你做关键词匹配项目(搜索引擎)---- 第四天

3. 手把手教你做关键词匹配项目(搜索引擎)---- 第三天

2. 手把手教你做关键词匹配项目(搜索引擎)---- 第二天

1. 手把手教你做关键词匹配项目(搜索引擎)---- 第一天

小帅帅拿到于老大的TopClient后,其实发现TopClient不就是Curl吗,其实我用ExtendedCurl是不是也可以做到呢,小帅帅对技术的热情不是一般的高涨,随手把于老大给的代码给改了一份。

小帅帅也有开窍的一天,从此他的路豁然开朗。

小帅帅改后的代码:

<?phpclass TopClient {    ......    protected function curl($url, $postFields = null)    {        $options = array(            CURLOPT_FAILONERROR=>false,            CURLOPT_RETURNTRANSFER=>true,            CURLOPT_CONNECTTIMEOUT=>15,            CURLOPT_TIMEOUT=>300,            CURLOPT_FOLLOWLOCATION=>1        );        $curl = new ExtendedCurl($options);        $reponse = $curl->post($url,$postFields);        if($curl->hasError()){            throw new Exception($curl->getError(), 0);        }else{            if(200 !== $curl->getHttpCode()){                throw new Exception($reponse, $curl->getHttpCode());            }        }        return $reponse;    }    ......}