TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Strange Curl problem (http://www.talkphp.com/general/5671-strange-curl-problem.html)

CΛSTΞX 01-04-2011 12:04 AM

Strange Curl problem
 
I am trying to get content from Bing Cache url. $bingurl is the url of the bing cache page. I echo $bingurl, it echos

http://cc.bingj.com/cache.aspx?d=489...763&w=4da51025

it means the url is correct. So I use

PHP Code:

curl_setopt($chCURLOPT_URL$bingurl);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$satir curl_exec($ch); 
curl_close($ch);
preg_match_all('#<h1(.*?)</h1>#si'$satir$soru2);

echo 
$soru[1][0]; 

But it doesnt get the content, however, if I use the code within like that,

PHP Code:


curl_setopt
($chCURLOPT_URL"http://cc.bingj.com/cache.aspx?d=4893209150818763&w=4da51025"); 

It works. What the hell ? :D

Salathe 01-04-2011 04:40 PM

And the only difference is that you use a hard-coded string versus a variable? If that's the case, are you entirely sure that the variable contains what you think it contains?

CΛSTΞX 01-04-2011 04:47 PM

Quote:

Originally Posted by Salathe (Post 31348)
And the only difference is that you use a hard-coded string versus a variable? If that's the case, are you entirely sure that the variable contains what you think it contains?

Yes, the same. I echod it to correct it, and corrected it. Maybe the problem occurs because of the special characters like "&" or "=" ? I did urlencode() and urldecode() , but nothing changed.

alonewolf 01-09-2011 12:06 AM

Can i see how u use the variable? I mean , $bingurl variable .


All times are GMT. The time now is 11:07 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0