Print Curl Verbose Info on the web browser in php

By default, the CURLOPT_VERBOSE option will print verbose info to the stderr stream. If you want to print the verbose info to the stdout stream and make it visible to the web browser it’s easy:


			  curl_setopt($hCurl, CURLOPT_STDERR, fopen('php://output', 'w+'));
			  curl_setopt($hCurl, CURLOPT_VERBOSE, 1);

Download a whole youtube playlist to your computer in php.

I don’t know if I should be sharing this code snippet, but this is just too cool!

  1. Get the code from the links on this page:
  2. Append this hack at the bottom of the php code:
$watch_ids	=	array();
$url = "";
$plyst	=	file_get_contents("");
$matchall	=	preg_match_all('/<li class="playlist-video-item[^>]+>([\s\S]*?)<\/li>/', $plyst, $matches);

$info		=	preg_match_all('/<span class="title video-title "[^>]+>([^<]+)/', $plyst, $desc);

#var_dump($desc, $matches);exit;
for($i = 0; $i < $matchall ; $i++)
  preg_match('/watch\?v=([a-zA-Z0-9]+)/', $matches[1][$i], $id);
  $id	=	$id[1];

  $itemurl	=	sprintf($url, $id);
  $itemdesc	=	preg_replace('/[^A-Za-z0-9\s\.]+/', '', $desc[1][$i]);

  $filename	=	"$itemdesc.flv";
  if(file_exists($filename)) continue;

  echo "Fetching: " , $itemdesc, "\n";
  $youtubegrabber = new youtubegrabber($itemurl, $filename, 0);

3. modify and enjoy

Bonus: Add this to the options in the get_curl_binary method to get download progress info.

        curl_setopt($ch, CURLOPT_NOPROGRESS, FALSE);


Custom Multi-Feature Clickbank Automation Software


A couple of years back, a client of mine decided to hire me to develop a custom application for automating certain actions based on sales information provided by clickbank’s api. This software is one of the most interesting projects I have worked on simply because of the array of services that it integrates and the things you are able to do with it.

Continue reading “Custom Multi-Feature Clickbank Automation Software” »