Answer the question
In order to leave comments, you need to log in
What's with the weird curl error?
I'm trying to save partner sites in yii2 on the topic of whether the product is in stock, I organized it using this method
public function haveParse($goods){
$ch = curl_init();
$url="$goods->url";
curl_setopt($ch, CURLOPT_URL, $url);
return curl_exec($ch);
}
boolean true
var_dump($goods->url)==string 'http://xn----7sblaeg7cgj4a.com.ua/ve6rhnjaja-odejda/3339-palto-frak.html'
if here curl_setopt($ch, CURLOPT_URL, $url);
replace withcurl_setopt($ch, CURLOPT_URL, 'http://xn----7sblaeg7cgj4a.com.ua/ve6rhnjaja-odejda/3339-palto-frak.html');
the page is complete. Don't tell me what's the problem.
Answer the question
In order to leave comments, you need to log in
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $goods->url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
return curl_exec($ch);
$url="$goods->url";
- Quotes why? It's the same variable. You write the string $goods->url" in $url and not the value from the variable
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question