J'ai donc cette fonction que j'essaye de faire avec cURL à cause des valeurs de serveur file_get_contents()
est désactivé.Réécrire la fonction file_get_content avec cURL
$url ='https://example.com' .
'/b/'.urlencode($this->user_ID).'/o/'.urlencode($this->ID);
$url=$url.'/h/'.urlencode($hash);
$number=rand(0, 10)/10 ."";
$url=$url.$number;
$html = file_get_contents($url);
preg_match('/<td valign="bottom" class="sum">(.*?)<\/td\>/', $html , $matches);
return $matches[0];
Ce que j'ai maintenant ce
$url ='https://example.com' .
'/b/'.urlencode($this->user_ID).'/o/'.urlencode($this->ID);
$number=rand(0, 10)/10 ."";
$url=$url.$number;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$matches = curl_exec($ch);
curl_close($ch);
$html = file_get_contents($url);
preg_match('/<td valign="bottom" class="sum">(.*?)<\/td\>/', $html , $matches);
return $matches[0];
Est-ce quelque chose comme ça ou je suis tout à fait sur le mauvais sens? Et comment changer maintenant cette ligne - $html = file_get_contents($url);
?
l'avez-vous essayé? est-ce que ça marche? Que s'est-il passé avec le $ url. '/ H /'. Urlencode ($ hash); 'vous n'en avez plus besoin? –
J'ai oublié $ url. '/ H /'. Urlencode ($ hash); 'il est là .. Quand je lance ceci avec curr j'essaie d'erreur' file_get_content(): https: // wrapper est désactivé sur ce serveur 'sur cette ligne' $ html = file_get_contents ($ url); ' –
vous avez dit que vous voulez utiliser curl, pourquoi lancez-vous le code' file_get_contents'? –