本帖最后由 u013366173 于 2015-03-03 22:35:09 编辑

解决方案 »

  1.   

    常用的功能要写成函数或类保存起来,以备不时之需
    而不是临阵擦枪include 'curl/curl_get.php';
    $url = 'http://miaoo.sinaapp.com/cai.php';
    echo curl_get($url);
    curl/curl_get.php<?php
    function curl_get($durl, $data=array()) {
      $cookiejar = realpath('cookie.txt');
      $t = parse_url($durl);
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL,$durl);
      curl_setopt($ch, CURLOPT_TIMEOUT,5);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
      curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
      curl_setopt($ch, CURLOPT_REFERER, "http://$t[host]/");
      curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar);
      curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
      curl_setopt($ch, CURLOPT_ENCODING, 1); //gzip 解码
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    if($data) {
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    }
      $r = curl_exec($ch);
      curl_close($ch);
      return $r;
    }
      

  2.   


    <?php 
    header('Content-Type:image/png');
    showAuthcode('http://miaoo.sinaapp.com/cai.php');
    function showAuthcode( $authcode_url )
    {
       
        $ch = curl_init($authcode_url);
    curl_setopt($ch, CURLOPT_REFERER, "http://52jifenbao.com/cai/");
        curl_exec($ch);
        curl_close($ch);
    }
    ?>网上找到,解决了