I was thinking the same thing about the "referrer." I rushed over to check on my apps after reading this thread. I know this has been broached before, but it sure would be nice to have a beta site for the devs to test against before changes go live.
On Jun 19, 7:04 am, Doug Williams <d...@twitter.com> wrote: > Can you include the specific request you are making? > > Thanks, > Doug > > > > On Fri, Jun 19, 2009 at 6:35 AM, Alan Evans <alanev...@gmail.com> wrote: > > Just a shot in the dark, but could it be caused by this?: > > >http://groups.google.com/group/twitter-development-talk/browse_thread... > > > It sounds like exactly the sort of thing that could cause an app to > > suddenly stop working. I see that your new code posted above contained a > > referer, but what about the code that was failing? How about putting in a > > User-Agent too, for good measure. > > > Regards, > > > Alan Evans > > > On Fri, Jun 19, 2009 at 2:50 PM, markanson <mark.an...@gmail.com> wrote: > > >> Marco it was all working fine for a month or more > > >> then today it stopped working > > >> My new code that I got from somewhere seems ok but I don't feel really > >> confident about this > > >> I am using this > > >> function file_post_contents($url,$headers=false) { > >> $url = parse_url($url); > > >> if (!isset($url['port'])) { > >> if ($url['scheme'] == 'http') { $url['port']=80; } > >> elseif ($url['scheme'] == 'https') { $url['port']=443; } > >> } > >> $url['query']=isset($url['query'])?$url['query']:''; > > >> $url['protocol']=$url['scheme'].'://'; > >> $eol="\r\n"; > > >> $headers = "POST ".$url['protocol'].$url['host'].$url['path']." > >> HTTP/1.0".$eol. > >> "Host: ".$url['host'].$eol. > >> "Referer: ".$url['protocol'].$url['host'].$url['path']. > >> $eol. > >> "Content-Type: application/x-www-form-urlencoded". > >> $eol. > >> "Content-Length: ".strlen($url['query']).$eol. > >> $eol.$url['query']; > >> $fp = fsockopen($url['host'], $url['port'], $errno, $errstr, 30); > >> if($fp) { > >> fputs($fp, $headers); > >> $result = ''; > >> while(!feof($fp)) { $result .= fgets($fp, 128); } > >> fclose($fp); > >> if (!$headers) { > >> //removes headers > >> $pattern="/^.*\r\n\r\n/s"; > >> $result=preg_replace($pattern,'',$result); > >> } > >> return $result; > >> } > >> }- Hide quoted text - > > - Show quoted text -